requestPermission method

Future<NotificationSettings> requestPermission(
  1. {bool alert = true,
  2. bool announcement = false,
  3. bool badge = true,
  4. bool carPlay = false,
  5. bool criticalAlert = false,
  6. bool provisional = false,
  7. bool sound = true}

Prompts the user for notification permissions.

  • On iOS, a dialog is shown requesting the users permission.
  • On macOS, a notification will appear asking to grant permission.
  • On Android, a NotificationSettings class will be returned with the value of NotificationSettings.authorizationStatus indicating whether the app has notifications enabled or blocked in the system settings.
  • On Web, a popup requesting the users permission is shown using the native browser API.

Note that on iOS, if provisional is set to true, silent notification permissions will be automatically granted. When notifications are delivered to the device, the user will be presented with an option to disable notifications, keep receiving them silently or enable prominent notifications.


Future<NotificationSettings> requestPermission({
  /// Request permission to display alerts. Defaults to `true`.
  /// iOS/macOS only.
  bool alert = true,

  /// Request permission for Siri to automatically read out notification messages over AirPods.
  /// Defaults to `false`.
  /// iOS only.
  bool announcement = false,

  /// Request permission to update the application badge. Defaults to `true`.
  /// iOS/macOS only.
  bool badge = true,

  /// Request permission to display notifications in a CarPlay environment.
  /// Defaults to `false`.
  /// iOS only.
  bool carPlay = false,

  /// Request permission for critical alerts. Defaults to `false`.
  /// Note; your application must explicitly state reasoning for enabling
  /// critical alerts during the App Store review process or your may be
  /// rejected.
  /// iOS only.
  bool criticalAlert = false,

  /// Request permission to provisionally create non-interrupting notifications.
  /// Defaults to `false`.
  /// iOS only.
  bool provisional = false,

  /// Request permission to play sounds. Defaults to `true`.
  /// iOS/macOS only.
  bool sound = true,
}) {
  return _delegate.requestPermission(
    alert: alert,
    announcement: announcement,
    badge: badge,
    carPlay: carPlay,
    criticalAlert: criticalAlert,
    provisional: provisional,
    sound: sound,