UNotificationEvent.fromMap constructor
Reads it from the native map.
Implementation
factory UNotificationEvent.fromMap(Map<Object?, Object?> m) {
Map<String, Object?>? payload;
final Object? raw = m["payload"];
if (raw is String && raw.isNotEmpty) {
try {
payload = (jsonDecode(raw) as Map<Object?, Object?>).map((Object? k, Object? v) => MapEntry<String, Object?>("$k", v));
} catch (_) {}
}
return UNotificationEvent(
type: UNotificationEventType.values.firstWhere((UNotificationEventType t) => t.name == m["type"], orElse: () => UNotificationEventType.tap),
id: (m["id"] as num?)?.toInt() ?? int.tryParse("${m["id"]}") ?? 0,
actionId: m["actionId"] as String?,
input: m["input"] as String?,
payload: payload,
);
}