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

Fix dart future not returning on cancel #134

Merged
merged 1 commit into from
Jul 30, 2019
Merged
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
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