createNotificationChannel static method

Future<bool> createNotificationChannel({
  1. required String channelId,
  2. required String channelName,
  3. String? channelDescription,
  4. int? importance,
  5. bool? enableLights,
  6. bool? enableVibration,
  7. String? sound,
})

创建通知渠道

channelId 渠道ID,必须唯一 channelName 渠道名称,用户可见 channelDescription 渠道描述,可选 importance 重要性级别,可选 enableLights 是否启用指示灯,可选 enableVibration 是否启用振动,可选 sound 通知声音,可选

返回 true 表示创建成功,false 表示失败

Implementation

static Future<bool> createNotificationChannel({
  required String channelId,
  required String channelName,
  String? channelDescription,
  int? importance,
  bool? enableLights,
  bool? enableVibration,
  String? sound,
}) {
  return _platform.createNotificationChannel(
    channelId: channelId,
    channelName: channelName,
    channelDescription: channelDescription,
    importance: importance,
    enableLights: enableLights,
    enableVibration: enableVibration,
    sound: sound,
  );
}