diff --git a/lib/core/models/change.dart b/lib/core/models/change.dart index 85183fe..00d4d8a 100644 --- a/lib/core/models/change.dart +++ b/lib/core/models/change.dart @@ -30,19 +30,19 @@ class Change { /// Serializes this change to a map for storage. Map toMap() => { - 'type': type.index, - 'sheetUuid': sheetUuid, - 'value': value, - 'createdAt': createdAt.toIso8601String(), - }; + 'type': type.index, + 'sheetUuid': sheetUuid, + 'value': value, + 'createdAt': createdAt.toIso8601String(), + }; /// Serializes this change to JSON for API requests. Map toJson() => { - 'type': type.name, - 'sheetUuid': sheetUuid, - 'value': value, - 'createdAt': createdAt.toIso8601String(), - }; + 'type': type.name, + 'sheetUuid': sheetUuid, + 'value': value, + 'createdAt': createdAt.toIso8601String(), + }; /// Deserializes a change from a stored map. /// @@ -91,9 +91,8 @@ class ChangeQueue { for (final change in _queue) { final sheet = sheets.firstWhere( (s) => s.uuid == change.sheetUuid, - orElse: () => throw StateError( - 'Sheet with UUID ${change.sheetUuid} not found', - ), + orElse: () => + throw StateError('Sheet with UUID ${change.sheetUuid} not found'), ); switch (change.type) { diff --git a/lib/core/services/storage_service.dart b/lib/core/services/storage_service.dart index c5dee3f..a5b2cae 100644 --- a/lib/core/services/storage_service.dart +++ b/lib/core/services/storage_service.dart @@ -14,15 +14,12 @@ class StoredAnnotation { final String annotationsJson; final DateTime lastModified; - StoredAnnotation({ - required this.annotationsJson, - required this.lastModified, - }); + StoredAnnotation({required this.annotationsJson, required this.lastModified}); Map toMap() => { - 'annotationsJson': annotationsJson, - 'lastModified': lastModified.toIso8601String(), - }; + 'annotationsJson': annotationsJson, + 'lastModified': lastModified.toIso8601String(), + }; factory StoredAnnotation.fromMap(Map map) { return StoredAnnotation( @@ -52,11 +49,11 @@ class PendingAnnotationUpload { }); Map toMap() => { - 'sheetUuid': sheetUuid, - 'page': page, - 'annotationsJson': annotationsJson, - 'lastModified': lastModified.toIso8601String(), - }; + 'sheetUuid': sheetUuid, + 'page': page, + 'annotationsJson': annotationsJson, + 'lastModified': lastModified.toIso8601String(), + }; factory PendingAnnotationUpload.fromMap(Map map) { return PendingAnnotationUpload( @@ -142,9 +139,8 @@ class StorageService { Future> readSheetAccessTimes() async { final box = await Hive.openBox(_sheetAccessTimesBox); return box.toMap().map( - (key, value) => - MapEntry(key as String, DateTime.parse(value as String)), - ); + (key, value) => MapEntry(key as String, DateTime.parse(value as String)), + ); } /// Records when a sheet was last accessed. @@ -308,8 +304,9 @@ class StorageService { Future deleteAllAnnotations(String sheetUuid) async { final box = await Hive.openBox(_annotationsBox); final prefix = '${sheetUuid}_page_'; - final keysToDelete = - box.keys.where((key) => key is String && key.startsWith(prefix)); + final keysToDelete = box.keys.where( + (key) => key is String && key.startsWith(prefix), + ); for (final key in keysToDelete.toList()) { await box.delete(key);