save method
Save preference to local storage
- Automatically update and save lastSaveTime
debugMsg
: easier to trace callerdateTime
: manually set the save time. Default isnull
and current time is used.noSaveTime
: set totrue
in case you don't want to update the save time. Default isfalse
.saved
: a callback function to be executed when save is finished- Do not override.
Implementation
Future<void> save({
DateTime? dateTime,
Function? saved,
String debugMsg = '',
bool noSaveTime = false,
}) async {
// Set pending flag
if (_noSave == 0) {
String debugPrefix = '$debugMsg -> $runtimeType.save()';
// Set pending
lazy.log(debugPrefix, forced: debugLogSave);
_saveWait(
debugMsg: debugPrefix,
dateTime: dateTime,
noSaveTime: noSaveTime,
saved: saved,
);
}
}