Skip to content

camera permission not working for flashlight , Have to restart app to make it work for flashlight using lamp 0.0.6 plugin #9

@Shavneet

Description

@Shavneet

I am using this code :

getCameraPermissionStatus() async {
var get = '';
List permissions = await Permission.getPermissionsStatus(
[PermissionName.Camera,]);
permissions.forEach((permission) {
get += '${permission.permissionName}: ${permission.permissionStatus}';
if (get != "PermissionName.Camera: PermissionStatus.allow") {
requestCameraPermission();
} else {
Lamp.turnOn();
}
});
}

requestCameraPermission() async {
final res = await Permission.requestPermissions([PermissionName.Camera,]);
res.forEach((permission) {
String a = '${permission.permissionStatus}';
setState(() {
if (a == 'PermissionStatus.allow') {
Lamp.turnOn();
}
else {
Permission.openSettings;
}
});
});
}

So with this code I am successfully turning On the camera permission but ''Lamp.turnOn()'' is not turning on the flash in first attempt . Has to restart the app to turn it on . Permission gets turned on in first attempt (can be checked in app info ) but starts working after killing app and restarting app .

Packages I am using :
permission: ^0.1.1
lamp: ^0.0.6 .

Please help if anyone knows anything about this or any other ideas will be appreciated . Thanks .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions