Closed vicajilau closed 1 year ago
I have found that PermissionStatus.permanentlyDenied is not handled in CunningDocumentScanner
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
class CunningDocumentScanner {
static const MethodChannel _channel =
MethodChannel('cunning_document_scanner');
/// Call this to start get Picture workflow.
static Future<List<String>?> getPictures() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.camera,
].request();
if (statuses.containsValue(PermissionStatus.denied) || statuses.containsValue(PermissionStatus.permanentlyDenied)) {
throw Exception("Permission not granted");
}
final List<dynamic>? pictures = await _channel.invokeMethod('getPictures');
return pictures?.map((e) => e as String).toList();
}
}
I will do a PR with this change. Greetings!!
Done
First of all, a wonderful package.
With Android 11 in API 30. When I set the permissions to NEVER it throws an execution exception.