use method
Future<PermissionStatus>
use(
{ - dynamic onAccept(
- PermissionStatus
)?,
- dynamic onDenied(
- PermissionStatus
)?,
- bool showSettingDialog = true,
- String? permissionTitle,
})
Implementation
Future<PermissionStatus> use({
Function(PermissionStatus)? onAccept,
Function(PermissionStatus)? onDenied,
bool showSettingDialog = true,
String? permissionTitle,
}) async {
Permission permission = await _handleMediaPermission();
final PermissionStatus status = await permission.request();
if (status.isGranted || status.isLimited) {
onAccept?.call(status);
} else if (onDenied != null) {
onDenied.call(status);
} else if (status.isPermanentlyDenied && showSettingDialog) {
String title = permissionTitle ?? permission._handleSettingTitle();
PermissionContext.showSettingDialog(text: title);
}
return status;
}