shouldShowRationaleToRequest method

  1. @override
Future<List<NotificationPermission>> shouldShowRationaleToRequest({
  1. String? channelKey,
  2. List<NotificationPermission> permissions = const [NotificationPermission.Badge, NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Vibration, NotificationPermission.Light],
})
override

Checks whether the app should show a rationale to the user before requesting notification permissions.

The optional channelKey parameter is a String that represents the key of the notification channel for which to check permissions. If this parameter is omitted, permissions will be checked for all channels.

The optional permissions parameter is a list of NotificationPermission values to check. This parameter is optional and defaults to a list of permissions that are commonly requested by apps, including NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Badge, NotificationPermission.Vibration, and NotificationPermission.Light.

This method returns a Future that resolves to a list of NotificationPermission values indicating which permissions require user intervention in order to be granted. If a permission requires user intervention, it will be included in the list. If a permission does not require user intervention, it will not be included in the list. If no permissions require user intervention, the list will be empty.

This method can be used to check whether the app should show a rationale to the user before requesting notification permissions. If any permissions require user intervention, the app should show a rationale to the user explaining why the permission is needed before requesting it.

Implementation

@override
Future<List<NotificationPermission>> shouldShowRationaleToRequest(
    {String? channelKey,
    List<NotificationPermission> permissions = const [
      NotificationPermission.Badge,
      NotificationPermission.Alert,
      NotificationPermission.Sound,
      NotificationPermission.Vibration,
      NotificationPermission.Light
    ]}) {
  return AwesomeNotificationsPlatform.instance.shouldShowRationaleToRequest(
    channelKey: channelKey,
    permissions: permissions,
  );
}