request method

Implementation

Future<PermissionStatus> request() async {
  if (permission == Permission.notification) {
    var status = await notification.NotificationPermissions
        .requestNotificationPermissions(
            iosSettings: const notification.NotificationSettingsIos(
                sound: true, badge: true, alert: true));

    switch (status) {
      case notification.PermissionStatus.granted:
        return PermissionStatus.granted;
      case notification.PermissionStatus.denied:
        return PermissionStatus.denied;
      case notification.PermissionStatus.provisional:
        return PermissionStatus.limited;
      case notification.PermissionStatus.unknown:
      default:
        return PermissionStatus.denied;
    }
  }

  return await permission.request();
}