added id to alarms

This commit is contained in:
2026-06-18 22:59:47 +02:00
parent e645081204
commit 82a74a66b5
3 changed files with 21 additions and 2 deletions
+14 -2
View File
@@ -1,15 +1,23 @@
import 'alarm.dart';
class TimeAlarm implements Alarm {
@override
final String id;
@override
final String taskId;
final DateTime triggerAt;
const TimeAlarm({required this.taskId, required this.triggerAt});
const TimeAlarm({
required this.id,
required this.taskId,
required this.triggerAt,
});
factory TimeAlarm.fromJson(Map<String, dynamic> json) {
return TimeAlarm(
id: json['id'] as String,
taskId: json['taskId'] as String,
triggerAt: DateTime.parse(json['triggerAt'] as String),
);
@@ -17,6 +25,10 @@ class TimeAlarm implements Alarm {
@override
Map<String, dynamic> toJson() {
return {'taskId': taskId, 'triggerAt': triggerAt.toIso8601String()};
return {
'id': id,
'taskId': taskId,
'triggerAt': triggerAt.toIso8601String(),
};
}
}