NotificationEvent.fromMap constructor

NotificationEvent.fromMap(
  1. Map map
)

Create the event from a map

Implementation

factory NotificationEvent.fromMap(Map<dynamic, dynamic> map) {
  map['hasLargeIcon'] =
      map['largeIcon'] != null && (map['largeIcon'] as Uint8List).isNotEmpty;
  var evt = NotificationEvent(
    createAt: DateTime.now(),
    uniqueId: map["_id"],
    key: map["key"],
    uid: map['uid'],
    channelId: map["channelId"],
    id: map['id'],
    packageName: map['package_name'],
    title: map['title'],
    text: map['text'],
    message: map["message"],
    timestamp: map["timestamp"],
    // icon: map['icon'],
    hasLargeIcon: map['hasLargeIcon'],
    largeIcon: map['largeIcon'],
    canTap: map["canTap"],
  );

  // set the raw data
  evt._data = map;

  // create the actions from map
  evt.actions = ((map["actions"] ?? []) as List<dynamic>)
      .map((e) => Action.fromMap(evt, e))
      .toList();

  return evt;
}