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;
|
final appState = container.appState;
|
||||||
|
|
||||||
// TODO: This should be made far more efficient
|
// TODO: This should be made far more efficient
|
||||||
List<Note> filteredNotes = [];
|
|
||||||
var q = query.toLowerCase();
|
var q = query.toLowerCase();
|
||||||
appState.notes.forEach((note) {
|
var filteredNotes = appState.notes.where((note) {
|
||||||
if (note.body.toLowerCase().contains(query)) {
|
return note.body.toLowerCase().contains(q);
|
||||||
filteredNotes.add(note);
|
}).toList();
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Widget journalList = JournalList(
|
Widget journalList = JournalList(
|
||||||
notes: filteredNotes,
|
notes: filteredNotes,
|
||||||
|
Reference in New Issue
Block a user