FlattenedNotesFolder: Always remove the note if present

In the FlattenedNotesFolder we can have a filter to only show certain
notes. This is used for showing notes that match some tags. When the
note is added to this virtual folder it matches the tag, but later it
does not.
This commit is contained in:
Vishesh Handa
2020-06-04 14:21:58 +02:00
parent 60de996761
commit e0815c664d

View File

@ -71,10 +71,12 @@ class FlattenedNotesFolder with NotesFolderNotifier implements NotesFolder {
}
void _noteRemoved(int _, Note note) {
if (filter != null && !filter(note)) {
var i = _notes.indexWhere((n) => n.filePath == note.filePath);
assert(filter == null ? i != -1 : true);
if (i == -1) {
return;
}
var i = _notes.indexWhere((n) => n.filePath == note.filePath);
assert(i != -1);
_notes.removeAt(i);