createNotificationChannel static method

Future<void> createNotificationChannel(
  1. String channelId,
  2. String channelName, {
  3. String? description,
  4. int? importance,
  5. bool? enableLight,
  6. bool? enableVibration,
  7. bool? showBadge,
  8. int? ledColor,
  9. List<int>? vibrationPattern,
})

Creates a channel using native API. Read more about channel at https://developer.android.com/training/notify-user/channels You can send notifications through only one channel, so users that have created that channel in their devices, can receive it, while rest of them can not. For android versions lower than 8.0 (API 26), this method has no function

Implementation

static Future<void> createNotificationChannel(
    String channelId, String channelName,
    {String? description,
    int? importance,
    bool? enableLight,
    bool? enableVibration,
    bool? showBadge,
    int? ledColor,
    List<int>? vibrationPattern}) async {
  if(!Platform.isAndroid) return;
  var args = {};
  args['channelId'] = channelId;
  args['channelName'] = channelName;
  args['description'] = description;
  args['importance'] = importance;
  args['enableLight'] = enableLight;
  args['enableVibration'] = enableVibration;
  args['showBadge'] = showBadge;
  args['ledColor'] = ledColor;
  args['vibrationPattern'] = vibrationPattern;

  return _channel.invokeMethod("Pushe.createNotificationChannel", args);
}