getDetails static method
AndroidNotificationDetails
getDetails({
- required String? iconName,
- required NotifySound sound,
- List<
NotifyAction> ? actions,
Implementation
static AndroidNotificationDetails getDetails({
required String? iconName,
required NotifySound sound,
List<NotifyAction>? actions,
}) {
// If we have a custom sound, we MUST use a specific channel for it.
// Android Notification Channels are immutable. Once created, you cannot change the sound.
// So we assume that if a user wants a specific sound, it belongs to a specific channel.
String channelId = ChannelManager.defaultChannelId;
String channelName = ChannelManager.defaultChannelName;
if (sound.name != null) {
channelId = '${ChannelManager.defaultChannelId}_${sound.name}';
channelName = 'Notifications (${sound.name})';
}
return AndroidNotificationDetails(
channelId,
channelName,
channelDescription: ChannelManager.defaultChannelDescription,
icon: iconName,
importance: Importance.max,
priority: Priority.high,
playSound: true,
sound: sound.name != null
? RawResourceAndroidNotificationSound(sound.name)
: null,
actions: actions
?.map((a) => AndroidNotificationAction(a.id, a.label))
.toList(),
);
}