32 lines
878 B
Dart
32 lines
878 B
Dart
class AppNotification {
|
|
final String id;
|
|
final String type;
|
|
final String title;
|
|
final String body;
|
|
final bool isRead;
|
|
final DateTime createdAt;
|
|
final Map<String, dynamic>? data;
|
|
|
|
const AppNotification({
|
|
required this.id,
|
|
required this.type,
|
|
required this.title,
|
|
required this.body,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
this.data,
|
|
});
|
|
|
|
factory AppNotification.fromJson(Map<String, dynamic> json) =>
|
|
AppNotification(
|
|
id: json['id'] as String,
|
|
type: json['type'] as String? ?? '',
|
|
title: json['title'] as String? ?? '',
|
|
body: json['body'] as String? ?? '',
|
|
isRead: json['isRead'] as bool? ?? false,
|
|
createdAt: DateTime.parse(
|
|
json['createdAt'] as String? ?? DateTime.now().toIso8601String()),
|
|
data: json['data'] as Map<String, dynamic>?,
|
|
);
|
|
}
|