Format code
This commit is contained in:
@@ -91,9 +91,8 @@ class ChangeQueue {
|
|||||||
for (final change in _queue) {
|
for (final change in _queue) {
|
||||||
final sheet = sheets.firstWhere(
|
final sheet = sheets.firstWhere(
|
||||||
(s) => s.uuid == change.sheetUuid,
|
(s) => s.uuid == change.sheetUuid,
|
||||||
orElse: () => throw StateError(
|
orElse: () =>
|
||||||
'Sheet with UUID ${change.sheetUuid} not found',
|
throw StateError('Sheet with UUID ${change.sheetUuid} not found'),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
switch (change.type) {
|
switch (change.type) {
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ class StoredAnnotation {
|
|||||||
final String annotationsJson;
|
final String annotationsJson;
|
||||||
final DateTime lastModified;
|
final DateTime lastModified;
|
||||||
|
|
||||||
StoredAnnotation({
|
StoredAnnotation({required this.annotationsJson, required this.lastModified});
|
||||||
required this.annotationsJson,
|
|
||||||
required this.lastModified,
|
|
||||||
});
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() => {
|
Map<String, dynamic> toMap() => {
|
||||||
'annotationsJson': annotationsJson,
|
'annotationsJson': annotationsJson,
|
||||||
@@ -142,8 +139,7 @@ class StorageService {
|
|||||||
Future<Map<String, DateTime>> readSheetAccessTimes() async {
|
Future<Map<String, DateTime>> readSheetAccessTimes() async {
|
||||||
final box = await Hive.openBox(_sheetAccessTimesBox);
|
final box = await Hive.openBox(_sheetAccessTimesBox);
|
||||||
return box.toMap().map(
|
return box.toMap().map(
|
||||||
(key, value) =>
|
(key, value) => MapEntry(key as String, DateTime.parse(value as String)),
|
||||||
MapEntry(key as String, DateTime.parse(value as String)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,8 +304,9 @@ class StorageService {
|
|||||||
Future<void> deleteAllAnnotations(String sheetUuid) async {
|
Future<void> deleteAllAnnotations(String sheetUuid) async {
|
||||||
final box = await Hive.openBox(_annotationsBox);
|
final box = await Hive.openBox(_annotationsBox);
|
||||||
final prefix = '${sheetUuid}_page_';
|
final prefix = '${sheetUuid}_page_';
|
||||||
final keysToDelete =
|
final keysToDelete = box.keys.where(
|
||||||
box.keys.where((key) => key is String && key.startsWith(prefix));
|
(key) => key is String && key.startsWith(prefix),
|
||||||
|
);
|
||||||
|
|
||||||
for (final key in keysToDelete.toList()) {
|
for (final key in keysToDelete.toList()) {
|
||||||
await box.delete(key);
|
await box.delete(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user