Files
GSFV2/gsf/lib/modals/notification_model.dart
2024-04-10 12:51:20 +05:30

68 lines
1.6 KiB
Dart

class NotificationModel {
bool success;
String message;
dynamic notificationCount;
List<NotificationReadData> notificationList;
NotificationModel({
required this.success,
required this.message,
required this.notificationCount,
required this.notificationList,
});
factory NotificationModel.fromJson(Map<String, dynamic> json) {
return NotificationModel(
success: json['success'],
message: json['message'],
notificationCount: json['notification_count'],
notificationList: (json['notification_list'] as List)
.map((item) => NotificationReadData.fromJson(item))
.toList(),
);
}
}
class NotificationReadData {
String isRead;
dynamic notificationId;
NotificationData notificationMasterData;
String timesAgo;
NotificationReadData({
required this.isRead,
required this.notificationId,
required this.notificationMasterData,
required this.timesAgo,
});
factory NotificationReadData.fromJson(Map<String, dynamic> json) {
return NotificationReadData(
isRead: json["is_read"],
notificationId: json["notification_id"],
notificationMasterData: NotificationData.fromJson(
json['notification_master_data'],
),
timesAgo: json["created_at"],
);
}
}
class NotificationData {
String title;
String message;
String isActive;
NotificationData({
required this.message,
required this.title,
required this.isActive,
});
factory NotificationData.fromJson(Map<String, dynamic> json) {
return NotificationData(
message: json["messages"],
title: json["title"],
isActive: json["is_active"],
);
}
}