NotificationChannel constructor
NotificationChannel({
- required String? channelKey,
- required String? channelName,
- required String? channelDescription,
- String? channelGroupKey,
- bool? channelShowBadge,
- NotificationImportance? importance,
- bool? playSound,
- String? soundSource,
- DefaultRingtoneType? defaultRingtoneType,
- bool? enableVibration,
- Int64List? vibrationPattern,
- bool? enableLights,
- Color? ledColor,
- int? ledOnMs,
- int? ledOffMs,
- String? groupKey,
- GroupSort? groupSort,
- GroupAlertBehavior? groupAlertBehavior,
- String? icon,
- Color? defaultColor,
- bool? locked,
- bool? onlyAlertOnce,
- NotificationPrivacy? defaultPrivacy,
- bool? criticalAlerts,
Implementation
NotificationChannel(
{required this.channelKey,
required this.channelName,
required this.channelDescription,
this.channelGroupKey,
this.channelShowBadge,
this.importance,
this.playSound,
this.soundSource,
this.defaultRingtoneType,
this.enableVibration,
this.vibrationPattern,
this.enableLights,
this.ledColor,
this.ledOnMs,
this.ledOffMs,
this.groupKey,
this.groupSort,
this.groupAlertBehavior,
this.icon,
this.defaultColor,
this.locked,
this.onlyAlertOnce,
this.defaultPrivacy,
this.criticalAlerts})
: super() {
channelKey = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_CHANNEL_KEY, channelKey, String);
channelName = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_CHANNEL_NAME, channelName, String);
channelDescription = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_CHANNEL_DESCRIPTION, channelDescription, String);
channelShowBadge = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_CHANNEL_SHOW_BADGE, channelShowBadge, bool);
channelGroupKey = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_CHANNEL_GROUP_KEY, channelGroupKey, String);
importance = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_IMPORTANCE, importance, NotificationImportance);
playSound = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_PLAY_SOUND, playSound, bool);
criticalAlerts = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_CHANNEL_CRITICAL_ALERTS, criticalAlerts, bool);
soundSource = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_SOUND_SOURCE, soundSource, String);
enableVibration = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_ENABLE_VIBRATION, enableVibration, bool);
vibrationPattern = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_VIBRATION_PATTERN, vibrationPattern, Int64List);
enableLights = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_ENABLE_LIGHTS, enableLights, bool);
ledColor = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_LED_COLOR, ledColor, Color);
ledOnMs = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_LED_ON_MS, ledOnMs, int);
ledOffMs = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_LED_OFF_MS, ledOffMs, int);
groupKey = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_GROUP_KEY, groupKey, String);
groupSort = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_GROUP_SORT, groupSort, GroupSort);
groupAlertBehavior = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_GROUP_ALERT_BEHAVIOR,
groupAlertBehavior,
GroupAlertBehavior);
icon =
LocalAssertUtils.getValueOrDefault(NOTIFICATION_ICON, icon, String);
defaultColor = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_DEFAULT_COLOR, defaultColor, Color);
locked =
LocalAssertUtils.getValueOrDefault(NOTIFICATION_LOCKED, locked, bool);
onlyAlertOnce = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_ONLY_ALERT_ONCE, onlyAlertOnce, bool);
defaultPrivacy = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_DEFAULT_PRIVACY, defaultPrivacy, NotificationPrivacy);
defaultRingtoneType = LocalAssertUtils.getValueOrDefault(
NOTIFICATION_DEFAULT_RINGTONE_TYPE,
defaultRingtoneType,
DefaultRingtoneType);
// For small icons, it's only allowed resource media types
assert(LocalStringUtils.isNullOrEmpty(icon) ||
LocalBitmapUtils().getMediaSource(icon!) == MediaSource.Resource);
}