mirror of
https://github.com/simplezhli/flutter_barcode_reader.git
synced 2024-11-23 03:19:24 +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>
|
@interface BarcodeScanPlugin : NSObject<FlutterPlugin, BarcodeScannerViewControllerDelegate>
|
||||||
|
|
||||||
@property(nonatomic, retain) FlutterResult result;
|
@property(nonatomic, copy) FlutterResult result;
|
||||||
@property (nonatomic, assign) UIViewController *hostViewController;
|
@property (nonatomic, assign) UIViewController *hostViewController;
|
||||||
@end
|
@end
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)cancel {
|
- (void)cancel {
|
||||||
|
[self.delegate barcodeScannerViewController:self didFailWithErrorCode:@"USER_CANCELED"];
|
||||||
[self dismissViewControllerAnimated:true completion:nil];
|
[self dismissViewControllerAnimated:true completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
|||||||
|
|
||||||
class BarcodeScanner {
|
class BarcodeScanner {
|
||||||
static const CameraAccessDenied = 'PERMISSION_NOT_GRANTED';
|
static const CameraAccessDenied = 'PERMISSION_NOT_GRANTED';
|
||||||
|
static const UserCanceled = 'USER_CANCELED';
|
||||||
static const MethodChannel _channel =
|
static const MethodChannel _channel =
|
||||||
const MethodChannel('com.apptreesoftware.barcode_scan');
|
const MethodChannel('com.apptreesoftware.barcode_scan');
|
||||||
static Future<String> scan() async => await _channel.invokeMethod('scan');
|
static Future<String> scan() async => await _channel.invokeMethod('scan');
|
||||||
|
Loading…
Reference in New Issue
Block a user