Format code
This commit is contained in:
@@ -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<String, dynamic> toMap() => {
|
||||
'annotationsJson': annotationsJson,
|
||||
'lastModified': lastModified.toIso8601String(),
|
||||
};
|
||||
'annotationsJson': annotationsJson,
|
||||
'lastModified': lastModified.toIso8601String(),
|
||||
};
|
||||
|
||||
factory StoredAnnotation.fromMap(Map<dynamic, dynamic> map) {
|
||||
return StoredAnnotation(
|
||||
@@ -52,11 +49,11 @@ class PendingAnnotationUpload {
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
'sheetUuid': sheetUuid,
|
||||
'page': page,
|
||||
'annotationsJson': annotationsJson,
|
||||
'lastModified': lastModified.toIso8601String(),
|
||||
};
|
||||
'sheetUuid': sheetUuid,
|
||||
'page': page,
|
||||
'annotationsJson': annotationsJson,
|
||||
'lastModified': lastModified.toIso8601String(),
|
||||
};
|
||||
|
||||
factory PendingAnnotationUpload.fromMap(Map<dynamic, dynamic> map) {
|
||||
return PendingAnnotationUpload(
|
||||
@@ -142,9 +139,8 @@ class StorageService {
|
||||
Future<Map<String, DateTime>> 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<void> 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);
|
||||
|
||||
Reference in New Issue
Block a user