RemoteMessage.fromMap constructor

RemoteMessage.fromMap(
  1. Map<String, dynamic> map
)

Constructs a RemoteMessage from a raw Map.

Implementation

factory RemoteMessage.fromMap(Map<String, dynamic> map) {
  return RemoteMessage(
    senderId: map['senderId'],
    data: map['data'] == null
        ? <String, dynamic>{}
        : Map<String, dynamic>.from(map['data']),
    from: map['from'],
    messageId: map['messageId']?.toString(),
    messageType: map['messageType'],
    title: map['notification'] == null ? null : map['notification']['title'],
    body: map['notification'] == null ? null : map['notification']['body'],
    sentTime: map['sentTime'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            int.parse(map['sentTime'].toString())),
    ttl: map['ttl'],
  );
}