68 lines
1.5 KiB
Dart
68 lines
1.5 KiB
Dart
class NotificationModel {
|
|
String? id;
|
|
String? title;
|
|
String? msg;
|
|
String? addedFor;
|
|
String? createdAt;
|
|
String? updatedAt;
|
|
int? v;
|
|
|
|
NotificationModel({
|
|
this.id,
|
|
this.title,
|
|
this.msg,
|
|
this.addedFor,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.v,
|
|
});
|
|
|
|
factory NotificationModel.fromJson(Map<String, dynamic> json) {
|
|
return NotificationModel(
|
|
id: json['_id'],
|
|
title: json['title'],
|
|
msg: json['msg'],
|
|
addedFor: json['added_for'],
|
|
createdAt: json['createdAt'],
|
|
updatedAt: json['updatedAt'],
|
|
v: json['__v'],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'_id': id,
|
|
'title': title,
|
|
'msg': msg,
|
|
'added_for': addedFor,
|
|
'createdAt': createdAt,
|
|
'updatedAt': updatedAt,
|
|
'__v': v,
|
|
};
|
|
}
|
|
}
|
|
|
|
class NotificationResponse {
|
|
String? returnMessage;
|
|
List<NotificationModel>? notifications;
|
|
|
|
NotificationResponse({this.returnMessage, this.notifications});
|
|
|
|
factory NotificationResponse.fromJson(Map<String, dynamic> json) {
|
|
return NotificationResponse(
|
|
returnMessage: json['return_message'],
|
|
notifications: json['notifications'] != null
|
|
? List<NotificationModel>.from(json['notifications']
|
|
.map((notification) => NotificationModel.fromJson(notification)))
|
|
: null,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'return_message': returnMessage,
|
|
'notifications': notifications?.map((notification) => notification.toJson()).toList(),
|
|
};
|
|
}
|
|
}
|