setChannel method

  1. @override
Future<void> setChannel(
  1. NotificationChannel notificationChannel, {
  2. bool forceUpdate = false,
})
override

Set a new notification channel or updates if already exists forceUpdate: completely updates the channel on Android Oreo and above, but cancels all current notifications.

Implementation

@override
Future<void> setChannel(NotificationChannel notificationChannel,
    {bool forceUpdate = false}) async {
  Map<String, dynamic> parameters = notificationChannel.toMap();
  parameters.addAll({CHANNEL_FORCE_UPDATE: forceUpdate});

  await methodChannel.invokeMethod(
      CHANNEL_METHOD_SET_NOTIFICATION_CHANNEL, parameters);
}