didvan-app/lib/models/notification_message.dart

68 lines
1.6 KiB
Dart

class NotificationMessage {
String? notificationType;
String? title;
String? body;
String? id;
String? type;
String? link;
String? image;
String? photo;
String? groupKey;
String? userId;
NotificationMessage({
this.notificationType,
this.title,
this.body,
this.id,
this.type,
this.link,
this.image,
this.photo,
this.groupKey,
this.userId,
});
NotificationMessage.fromJson(Map<String, dynamic> json) {
notificationType = json['notificationType'];
title = json['title'];
body = json['body'];
id = json['id'];
type = json['type'];
link = json['link'];
image = json['image'];
photo = json['photo'];
groupKey = json['groupKey'];
userId = json['userId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['notificationType'] = notificationType;
data['title'] = title;
data['body'] = body;
data['id'] = id;
data['type'] = type;
data['link'] = link;
data['image'] = image;
data['photo'] = photo;
data['groupKey'] = groupKey;
data['userId'] = userId;
return data;
}
Map<String, String> toPayload() {
final Map<String, String> data = <String, String>{};
data['notificationType'] = notificationType ?? '';
data['title'] = title ?? '';
data['body'] = body ?? '';
data['id'] = id ?? '';
data['type'] = type ?? '';
data['link'] = link ?? '';
data['image'] = image ?? '';
data['photo'] = photo ?? '';
data['userId'] = userId ?? '';
return data;
}
}