rd-android-app/lib/models/announcement_response.dart
2024-10-14 16:35:42 +05:30

43 lines
1.0 KiB
Dart

class AnnouncementResponse {
String? id;
String? uniqueId;
List<String>? sentTo;
String? message;
DateTime? createdAt;
DateTime? updatedAt;
int? v;
AnnouncementResponse({
this.id,
this.uniqueId,
this.sentTo,
this.message,
this.createdAt,
this.updatedAt,
this.v,
});
factory AnnouncementResponse.fromJson(Map<String, dynamic> json) {
return AnnouncementResponse(
id: json['_id'],
uniqueId: json['uniqueId'],
sentTo: json['sentTo'] != null ? List<String>.from(json['sentTo']) : null,
message: json['message'],
createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt']) : null,
updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt']) : null,
v: json['__v'],
);
}
Map<String, dynamic> toJson() {
return {
'_id': id,
'uniqueId': uniqueId,
'sentTo': sentTo,
'message': message,
'createdAt': createdAt?.toIso8601String(),
'updatedAt': updatedAt?.toIso8601String(),
'__v': v,
};
}
}