mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
Simplify code by using List.where
This commit is contained in:
@ -125,13 +125,10 @@ class NoteSearch extends SearchDelegate<Note> {
|
||||
final appState = container.appState;
|
||||
|
||||
// TODO: This should be made far more efficient
|
||||
List<Note> filteredNotes = [];
|
||||
var q = query.toLowerCase();
|
||||
appState.notes.forEach((note) {
|
||||
if (note.body.toLowerCase().contains(query)) {
|
||||
filteredNotes.add(note);
|
||||
}
|
||||
});
|
||||
var filteredNotes = appState.notes.where((note) {
|
||||
return note.body.toLowerCase().contains(q);
|
||||
}).toList();
|
||||
|
||||
Widget journalList = JournalList(
|
||||
notes: filteredNotes,
|
||||
|
Reference in New Issue
Block a user