NotificationChannel class

Represents default settings applied to all notifications sharing the same channel key. Note: The soundSource needs to be a native resource media type.

Constructors

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})
Constructs a NotificationChannel.

Properties

channelDescription String?
Description of the notification channel.
getter/setter pair
channelGroupKey String?
Key for the channel group this channel belongs to.
getter/setter pair
channelKey String?
Unique identifier for the notification channel.
getter/setter pair
channelName String?
Name of the notification channel.
getter/setter pair
channelShowBadge bool?
Indicates whether to show a badge for notifications in this channel.
getter/setter pair
criticalAlerts bool?
Indicates whether notifications in this channel are critical alerts.
getter/setter pair
defaultColor Color?
Default color for notifications in this channel.
getter/setter pair
defaultPrivacy NotificationPrivacy?
Default privacy level for notifications in this channel.
getter/setter pair
defaultRingtoneType DefaultRingtoneType?
Default ringtone type for notifications in this channel.
getter/setter pair
enableLights bool?
Indicates whether to enable LED lights for notifications in this channel.
getter/setter pair
enableVibration bool?
Indicates whether to enable vibration for notifications in this channel.
getter/setter pair
groupAlertBehavior GroupAlertBehavior?
Alert behavior for grouped notifications.
getter/setter pair
groupKey String?
Key for grouping notifications in this channel.
getter/setter pair
groupSort GroupSort?
Sort order for grouped notifications.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
icon String?
Icon for notifications in this channel.
getter/setter pair
importance NotificationImportance?
The importance level for notifications in this channel.
getter/setter pair
ledColor Color?
The color of the LED light for notifications in this channel.
getter/setter pair
ledOffMs int?
Duration in milliseconds for which the LED light is off.
getter/setter pair
ledOnMs int?
Duration in milliseconds for which the LED light is on.
getter/setter pair
locked bool?
Indicates whether this channel is locked (cannot be modified or deleted by the user).
getter/setter pair
onlyAlertOnce bool?
Indicates whether to alert only once for notifications in this channel.
getter/setter pair
playSound bool?
Indicates whether to play a sound for notifications in this channel.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
soundSource String?
The sound resource to play for notifications in this channel.
getter/setter pair
vibrationPattern Int64List?
Vibration pattern for notifications in this channel.
getter/setter pair

Methods

fromMap(Map<String, dynamic> mapData) NotificationChannel
Creates a NotificationChannel instance from a map of data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
Converts the NotificationChannel instance to a map.
toString() String
A string representation of this object.
inherited
validate() → void
Validates the properties of the notification channel.

Operators

operator ==(Object other) bool
The equality operator.
inherited