setNotificationOptions method

Future<void> setNotificationOptions(
  1. List<IOSNotificationOption> options
)

Sets the notification options.

Implementation

Future<void> setNotificationOptions(
    List<IOSNotificationOption> options) async {
  if (!Platform.isIOS) {
    return Future.value();
  }

  var strings = <String>[];
  for (var element in options) {
    switch (element) {
      case IOSNotificationOption.alert:
        strings.add("alert");
        break;
      case IOSNotificationOption.sound:
        strings.add("sound");
        break;
      case IOSNotificationOption.badge:
        strings.add("badge");
        break;
      case IOSNotificationOption.carPlay:
        strings.add("car_play");
        break;
      case IOSNotificationOption.criticalAlert:
        strings.add("critical_alert");
        break;
      case IOSNotificationOption.providesAppNotificationSettings:
        strings.add("provides_app_notification_settings");
        break;
      case IOSNotificationOption.provisional:
        strings.add("provisional");
        break;
    }
  }

  return await _module.channel
      .invokeMethod('push#ios#setNotificationOptions', strings);
}