Note: Always flush the file when writing

This may fix some edge cases where the notes aren't being saved.
This commit is contained in:
Vishesh Handa
2020-08-10 23:49:13 +02:00
parent 0c467e6b01
commit 7b1e328c7e

View File

@ -50,7 +50,8 @@ class Note with NotesNotifier {
NoteFileFormat _fileFormat; NoteFileFormat _fileFormat;
MdYamlDoc _data = MdYamlDoc(); MdYamlDoc _data = MdYamlDoc();
NoteSerializer noteSerializer = NoteSerializer.fromSettings(Settings.instance); NoteSerializer noteSerializer =
NoteSerializer.fromSettings(Settings.instance);
DateTime fileLastModified; DateTime fileLastModified;
@ -295,7 +296,7 @@ class Note with NotesNotifier {
var file = File(filePath); var file = File(filePath);
var contents = _serializer.encode(data); var contents = _serializer.encode(data);
await file.writeAsString(contents); await file.writeAsString(contents, flush: true);
} }
String serialize() { String serialize() {