save method
Data stored in the model is stored in a database external to the app that is tied to the model.
The updated Resuult
can be obtained at the stage where the loading is finished.
Implementation
@override
Future<void> save() async {
if (_saveCompleter != null) {
return saving;
}
_saveCompleter = Completer<void>();
try {
await onSave();
await saveRequest();
notifyListeners();
await onDidSave();
_saveCompleter?.complete();
_saveCompleter = null;
} catch (e) {
_saveCompleter?.completeError(e);
_saveCompleter = null;
rethrow;
} finally {
_saveCompleter?.complete();
_saveCompleter = null;
}
}