fix removing single file from scanned pages

Removing a single file from scanned pages failed with
UnmodifiableListMixin.remove (dart:_internal/list.dart:134)

This filters the list instead of trying to remove from it.

fixes #395
Signed-off-by: Jörg Vehlow <joerg@jv-coder.de>
This commit is contained in:
Jörg Vehlow
2024-04-25 19:44:50 +02:00
parent 94b5cedbec
commit 7544796be4

View File

@@ -64,7 +64,7 @@ class DocumentScannerCubit extends Cubit<DocumentScannerState> {
stackTrace: stackTrace,
);
}
final scans = state.scans..remove(file);
final scans = state.scans.where((f) => f != file).toList();
emit(
scans.isEmpty
? const DocumentScannerState()