PushNotificationPayload.fromJson constructor
PushNotificationPayload.fromJson(
- dynamic json
Factory method to create an instance of PushNotificationPayload from JSON
Implementation
factory PushNotificationPayload.fromJson(dynamic json) {
Map<String, dynamic> jsonMap;
if (json is Map<String, dynamic>) {
jsonMap = json;
} else {
if (json is String) {
try {
jsonMap = jsonDecode(json);
} catch (error) {
jsonMap = {};
}
} else {
jsonMap = {};
}
}
return PushNotificationPayload(
titleMobile: jsonMap["titleMobile"] ?? "",
createdAt: jsonMap["createdAt"] ?? "",
linkMobile: jsonMap["linkMobile"] ?? "",
data: jsonMap,
);
}