show method
Future
show(
- PushHandleStrategy<
NotificationPayload> strategy, - NotificationCallback onSelectNotification
Displaying notification from the strategy.
Implementation
Future<dynamic> show(
PushHandleStrategy strategy,
NotificationCallback onSelectNotification,
) {
final androidSpecifics = AndroidNotificationSpecifics(
channelId: strategy.notificationChannelId,
channelName: strategy.notificationChannelName,
autoCancelable: strategy.autoCancelable,
color: strategy.color,
icon: strategy.icon,
);
final platformSpecifics = NotificationSpecifics(androidSpecifics);
// ignore: avoid_print
print(
'DEV_INFO receive for show push : ${strategy.payload.title}, '
'${strategy.payload.body}',
);
final pushId = DateTime.now().millisecondsSinceEpoch;
final tmpPayload = strategy.payload.messageData.map(
// ignore: avoid_annotating_with_dynamic
(key, dynamic value) => MapEntry(
key.toString(),
value.toString(),
),
);
tmpPayload[pushIdParam] = '$pushId';
callbackMap[pushId] = onSelectNotification;
return notificator.show(
strategy.pushId,
strategy.payload.title,
strategy.payload.body,
imageUrl: strategy.payload.imageUrl,
data: tmpPayload,
notificationSpecifics: platformSpecifics,
);
}