createPromotionalNotification method
Creates a promotional notification template.
Implementation
NotificationPayload createPromotionalNotification({
required String id,
required String title,
required String body,
String? imageUrl,
String? ctaText,
String? ctaUrl,
Map<String, dynamic>? data,
}) {
final List<NotificationAction> actions = <NotificationAction>[];
if (ctaText != null) {
actions.add(
NotificationAction(
id: 'cta',
title: ctaText,
showsUserInterface: true,
payload: ctaUrl,
),
);
}
return NotificationPayload(
id: id,
title: title,
body: body,
data: <String, dynamic>{
'type': 'promotional',
'ctaUrl': ctaUrl,
...?data,
},
imageUrl: imageUrl,
actions: actions,
importance: NotificationImportance.low,
priority: NotificationPriority.low,
category: 'promo',
);
}