2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-05-10 19:28:51 +00:00
inventree-app/lib/inventree/notification.dart
Oliver Walters 6bbae67482 Add model for notifications
- Display a list of active notifications
2022-05-04 11:11:29 +10:00

31 lines
714 B
Dart

import "package:inventree/inventree/model.dart";
/*
* Class representing a "notification"
*/
class InvenTreeNotification extends InvenTreeModel {
InvenTreeNotification() : super();
InvenTreeNotification.fromJson(Map<String, dynamic> json) : super.fromJson(json);
@override
InvenTreeNotification createFromJson(Map<String, dynamic> json) {
return InvenTreeNotification.fromJson(json);
}
@override
String get URL => "notifications/";
String get message => (jsondata["message"] ?? "") as String;
DateTime? get creationDate {
if (jsondata.containsKey("creation")) {
return DateTime.tryParse((jsondata["creation"] ?? "") as String);
} else {
return null;
}
}
}