log('value: $value ${await Permission.notification.isDenied}');
log('value: $value ${await Permission.notification.isPermanentlyDenied}');
const permission = Permission.notification;
final status = await permission.status;
if (status.isGranted) {
print('User granted this permission before');
} else {
final before = await permission.shouldShowRequestRationale;
final rs = await permission.request();
final after = await permission.shouldShowRequestRationale;
if (!before && !after && context.mounted && value) {
await showDialog(
context: context,
builder: (BuildContext context) {
return const PushAlarmModal();
});
}
}
Dart
복사