Renamed all Timer named things to TimeProgress
Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
This commit is contained in:
36
lib/persistence/time_progress_entity.dart
Normal file
36
lib/persistence/time_progress_entity.dart
Normal file
@ -0,0 +1,36 @@
|
||||
class TimeProgressEntity {
|
||||
final String id;
|
||||
final DateTime startTime;
|
||||
final DateTime endTime;
|
||||
|
||||
TimeProgressEntity(this.id, this.startTime, this.endTime);
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode ^ startTime.hashCode ^ endTime.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is TimeProgressEntity &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
startTime == other.startTime &&
|
||||
endTime == other.endTime;
|
||||
|
||||
Map<String, Object> toJson() {
|
||||
return {
|
||||
"id": id,
|
||||
"startTime": startTime.millisecondsSinceEpoch,
|
||||
"endTime": startTime.millisecondsSinceEpoch
|
||||
};
|
||||
}
|
||||
|
||||
static TimeProgressEntity fromJson(Map<String, Object> json) {
|
||||
final String id = json["id"] as String;
|
||||
final DateTime startTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(json["startTime"] as int);
|
||||
final DateTime endTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(json["endTime"] as int);
|
||||
return TimeProgressEntity(id, startTime, endTime);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user