requestPermissions static method
Future<void>
requestPermissions({
- bool alert = true,
- bool badge = true,
- bool sound = true,
- bool provisional = false,
- bool critical = false,
- bool vibrate = true,
- bool enableLights = true,
- String channelId = 'default_notification_channel_id',
- String channelName = 'Default Notification Channel',
- String? description,
- String? groupId,
- Importance? importance,
- List<
int> ? vibratePattern, - Color? ledColor,
- AudioAttributesUsage? audioAttributesUsage,
Requests notification permissions from the user.
Implementation
static Future<void> requestPermissions({
bool alert = true,
bool badge = true,
bool sound = true,
bool provisional = false,
bool critical = false,
bool vibrate = true,
bool enableLights = true,
String channelId = 'default_notification_channel_id',
String channelName = 'Default Notification Channel',
String? description,
String? groupId,
Importance? importance,
List<int>? vibratePattern,
Color? ledColor,
AudioAttributesUsage? audioAttributesUsage,
}) async {
_assertNotWeb();
await Nylo.localNotifications((localNotifications) async {
if (Platform.isIOS) {
await localNotifications
.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin
>()
?.requestPermissions();
return;
}
if (Platform.isAndroid) {
await localNotifications
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin
>()
?.requestNotificationsPermission();
return;
}
throw const NotificationException('Platform not supported');
});
}