mirror of
https://github.com/simplezhli/flutter_barcode_reader.git
synced 2024-11-25 09:19:22 +08:00
main, example: added CameraAccessDenied constant
This commit is contained in:
parent
2156fe33fe
commit
616b286a5c
@ -48,7 +48,7 @@ class _MyAppState extends State<MyApp> {
|
||||
String barcode = await BarcodeScanner.scan();
|
||||
setState(() => this.barcode = barcode);
|
||||
} on PlatformException catch (e) {
|
||||
if (e.code == 'PERMISSION_NOT_GRANTED') {
|
||||
if (e.code == BarcodeScanner.CameraAccessDenied) {
|
||||
setState(() {
|
||||
this.barcode = 'The user did not grant the camera permission!';
|
||||
});
|
||||
|
@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class BarcodeScanner {
|
||||
static const CameraAccessDenied = 'PERMISSION_NOT_GRANTED';
|
||||
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