showNotification method

  1. @override
Future<void> showNotification(
  1. NotificationMessage notification,
  2. String? applicationId
)
override

Implementation

@override
Future<void> showNotification(final NotificationMessage notification,
    final String? applicationId) async {
  final data = notification.toJson;
  if (applicationId != null) data["application_id"] = applicationId;
  String? templateXml = templates[notification.methodNmae]?.trim();
  if (notification.largeImage != null) {
    templateXml = templateXml?.replaceFirst("#1#", notification.largeImage!);
  } else {
    templateXml = templateXml?.replaceFirst("#1#", '');
  }

  data["template"] = templateXml;
  await methodChannel.invokeMethod(notification.methodNmae, data);
}