mirror of
https://github.com/simplezhli/flutter_barcode_reader.git
synced 2024-12-23 07:39:20 +08:00
Fix dart future not returning on cancel
This commit is contained in:
parent
42714900ca
commit
73c7a7ea3b
@ -9,6 +9,6 @@
|
||||
|
||||
@interface BarcodeScanPlugin : NSObject<FlutterPlugin, BarcodeScannerViewControllerDelegate>
|
||||
|
||||
@property(nonatomic, retain) FlutterResult result;
|
||||
@property(nonatomic, copy) FlutterResult result;
|
||||
@property (nonatomic, assign) UIViewController *hostViewController;
|
||||
@end
|
||||
|
@ -82,6 +82,7 @@
|
||||
}
|
||||
|
||||
- (void)cancel {
|
||||
[self.delegate barcodeScannerViewController:self didFailWithErrorCode:@"USER_CANCELED"];
|
||||
[self dismissViewControllerAnimated:true completion:nil];
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
|
||||
class BarcodeScanner {
|
||||
static const CameraAccessDenied = 'PERMISSION_NOT_GRANTED';
|
||||
static const UserCanceled = 'USER_CANCELED';
|
||||
static const MethodChannel _channel =
|
||||
const MethodChannel('com.apptreesoftware.barcode_scan');
|
||||
static Future<String> scan() async => await _channel.invokeMethod('scan');
|
||||
|
Loading…
Reference in New Issue
Block a user