mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Refactored events to notifications on front-end, added prefutils to read
shared preferences.
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user