Refactored events to notifications on front-end, added prefutils to read

shared  preferences.
This commit is contained in:
rzuasti
2026-03-02 13:59:50 -05:00
parent 2d64efa44b
commit e6b5594226
14 changed files with 293 additions and 38 deletions
+38
View File
@@ -0,0 +1,38 @@
import 'notification_type.dart';
class Notification {
int id;
String title;
String body;
bool isNew;
NotificationType notificationType;
DateTime createdOn;
Notification({
required this.id,
required this.title,
required this.body,
required this.notificationType,
required this.createdOn,
this.isNew = true,
});
Notification.fromJson(Map<String, dynamic> json)
: id = json['id'] as int,
createdOn = DateTime.parse(json['created_on'] as String),
notificationType = NotificationType.fromString(
json['notification_type'] as String,
),
title = json['title'] as String,
body = json['body'] as String,
isNew = json['is_new'] as bool;
Map<String, dynamic> toJson() => {
'id': id,
'created_on': createdOn.toUtc().toIso8601String(),
'notification_type': notificationType.toString,
'title': title,
'body': body,
'is_new': isNew,
};
}