Add Note.apply

Avoid calling each setter as each results in the entire tree being
rebuilt.
This commit is contained in:
Vishesh Handa
2021-09-16 19:36:11 +02:00
parent fd8516e926
commit 510b277398
21 changed files with 241 additions and 199 deletions

View File

@ -154,7 +154,7 @@ class OrgEditorState extends State<OrgEditor>
Future<void> addImage(String filePath) async {
var note = getNote();
var image = await core.Image.copyIntoFs(note.parent, filePath);
note.body += image.toMarkup(note.fileFormat);
note.apply(body: note.body + image.toMarkup(note.fileFormat));
setState(() {
_textController.text = note.body;