extractMessage method

PushMessageContent extractMessage(
  1. Map<String, dynamic> input
)

Loads push message from fcm payload.

Implementation

PushMessageContent extractMessage(Map<String, dynamic> input) {
  final type = input["envelopeType"] as String?;
  dynamic body;
  final payload = input["contentPayload"] as String?;
  if (payload != null) {
    body = convertMessage?.call(type, input["contentPayload"] as String?);
  }

  final Notification? notification = input["isNotification"] != "true"
      ? null
      : (Notification()
        ..title = input["title"] as String?
        ..subtitle = input["subtitle"] as String?
        ..body = input["body"] as String?
        ..imageUrl = (input["imageUrl"] as String?)?.toUri());
  return PushMessageContent()
    ..envelopeType = type
    ..body = body
    ..nativePush = false
    ..notification = notification;
}