Files
ProxyTrash/lib/models/route_notification.dart

27 lines
725 B
Dart

class RouteNotification {
const RouteNotification({
required this.triggerEvent,
required this.condition,
required this.title,
required this.body,
});
final String triggerEvent;
final String condition;
final String title;
final String body;
factory RouteNotification.fromJson(Map<String, dynamic> json) {
final payload = json['pushPayload'] is Map<String, dynamic>
? json['pushPayload'] as Map<String, dynamic>
: <String, dynamic>{};
return RouteNotification(
triggerEvent: json['triggerEvent'].toString(),
condition: json['condition'].toString(),
title: payload['title']?.toString() ?? '',
body: payload['body']?.toString() ?? '',
);
}
}