Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullsafety.1 #69

Open
wants to merge 5 commits into
base: nullsafety.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions ios/Classes/QrReaderViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ - (BOOL)startReading {
}
[_captureSession addInput:input];
AVCaptureMetadataOutput *captureMetadataOutput = [[AVCaptureMetadataOutput alloc] init];

[_captureSession addOutput:captureMetadataOutput];
dispatch_queue_t dispatchQueue;
dispatchQueue = dispatch_queue_create("myQueue", NULL);
[captureMetadataOutput setMetadataObjectsDelegate:self queue:dispatchQueue];
[captureMetadataOutput setMetadataObjectTypes:[NSArray arrayWithObject:AVMetadataObjectTypeQRCode]];
[captureMetadataOutput setMetadataObjectTypes:[NSArray arrayWithObjects:AVMetadataObjectTypeQRCode, AVMetadataObjectTypeCode128Code,nil]];
_videoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:_captureSession];
[_videoPreviewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
[_videoPreviewLayer setFrame:_qrcodeview.layer.bounds];
Expand All @@ -95,13 +96,11 @@ - (BOOL)startReading {
-(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection{
if (metadataObjects != nil && [metadataObjects count] > 0) {
AVMetadataMachineReadableCodeObject *metadataObj = [metadataObjects objectAtIndex:0];
if ([[metadataObj type] isEqualToString:AVMetadataObjectTypeQRCode]) {
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
[dic setObject:[metadataObj stringValue] forKey:@"text"];
[_channel invokeMethod:@"onQRCodeRead" arguments:dic];
[self performSelectorOnMainThread:@selector(stopReading) withObject:nil waitUntilDone:NO];
_isReading = NO;
}
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
[dic setObject:[metadataObj stringValue] forKey:@"text"];
[_channel invokeMethod:@"onQRCodeRead" arguments:dic];
[self performSelectorOnMainThread:@selector(stopReading) withObject:nil waitUntilDone:NO];
_isReading = NO;
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: flutter_qr_reader
description: QR code (scan QRCode and picture) recognition (AndroidView/UiKitView)
description: A flutter plugin for install apk for android; and using url to go to app store for iOS.
version: 1.0.5
homepage: https://github.com/hetian9288/flutter_qr_reader

Expand Down