From 5784399ac63effd6dde23401ef15c1db8ad6bf6b Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Mon, 20 Apr 2020 01:56:32 +0200 Subject: [PATCH] Remove NotesFolderFS::insert The position of the note in the folder doesn't matter as Virtual folders on top of this sort it according to how to how the user wants them to be sorted. --- lib/core/notes_folder_fs.dart | 11 ----------- lib/state_container.dart | 4 ++-- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/core/notes_folder_fs.dart b/lib/core/notes_folder_fs.dart index 6bab0c3c..faa2148b 100644 --- a/lib/core/notes_folder_fs.dart +++ b/lib/core/notes_folder_fs.dart @@ -247,17 +247,6 @@ class NotesFolderFS with NotesFolderNotifier implements NotesFolder { notifyNoteAdded(_notes.length - 1, note); } - void insert(int index, Note note) { - assert(note.parent == this); - assert(index >= 0); - note.addModifiedListener(_noteModified); - - _notes.insert(index, note); - _entityMap[note.filePath] = note; - - notifyNoteAdded(index, note); - } - void remove(Note note) { assert(note.parent == this); note.removeModifiedListener(_noteModified); diff --git a/lib/state_container.dart b/lib/state_container.dart index 24964368..3ad373f9 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -200,7 +200,7 @@ class StateContainer with ChangeNotifier { void addNote(Note note) async { return _opLock.synchronized(() async { Log.d("State Container addNote"); - note.parent.insert(0, note); + note.parent.add(note); note.updateModified(); _gitRepo.addNote(note).then((NoteRepoResult _) { _syncNotes(); @@ -225,7 +225,7 @@ class StateContainer with ChangeNotifier { void undoRemoveNote(Note note) async { return _opLock.synchronized(() async { - note.parent.insert(0, note); + note.parent.add(note); _gitRepo.resetLastCommit().then((NoteRepoResult _) { _syncNotes(); });