requestCameraPermission method
Requests camera permission and returns whether the permission is granted.
This function asynchronously requests camera permission from the user. It returns a Future that completes with a boolean value:
true
if the user grants the camera permission.false
if the user denies the camera permission or if the permission was previously denied.
Implementation
Future<bool> requestCameraPermission() async {
return await Permission.camera.request().isGranted;
}