Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Commit

Permalink
Fix dart future not returning on cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon.maness committed Jul 22, 2019
1 parent 4271490 commit 73c7a7e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ios/Classes/BarcodeScanPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions ios/Classes/BarcodeScannerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ - (void)startScan {
}

- (void)cancel {
[self.delegate barcodeScannerViewController:self didFailWithErrorCode:@"USER_CANCELED"];
[self dismissViewControllerAnimated:true completion:nil];
}

Expand Down
1 change: 1 addition & 0 deletions lib/barcode_scan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 73c7a7e

Please sign in to comment.