requestPermission method

Future<bool> requestPermission()

Shows notification permission request.

Implementation

Future<bool> requestPermission() async {
  late bool? result;

  if (Platform.isAndroid) {
    result = await localNotif
        .resolvePlatformSpecificImplementation<
            AndroidFlutterLocalNotificationsPlugin>()
        ?.requestPermission();
  } else {
    result = await localNotif
        .resolvePlatformSpecificImplementation<
            IOSFlutterLocalNotificationsPlugin>()
        ?.requestPermissions(
          alert: true,
          badge: true,
          sound: true,
        );
  }
  return result ?? false;
}