save method

  1. @override
Future<void> save({
  1. DateTime? dateTime,
  2. Function? saved,
  3. String debugMsg = '',
  4. bool noSaveTime = false,
  5. bool saveNotify = true,
})
override

Save preference to local storage

  • Automatically update and save lastSaveTime
  • debugMsg : easier to trace caller
  • dateTime : manually set the save time. Default is null and current time is used.
  • noSaveTime : set to true in case you don't want to update the save time. Default is false.
  • saveNotify : If true, trigger saveNotifier at end of call. Default true.
  • saved : a callback function to be executed when save is finished. DO NOT ADD saveNotifier here, it is already done for you.
  • Do not override.

Implementation

@override
Future<void> save({
  DateTime? dateTime,
  Function? saved,
  String debugMsg = '',
  bool noSaveTime = false,
  bool saveNotify = true,
}) async =>
    super.save(
      debugMsg: debugMsg,
      dateTime: dateTime,
      noSaveTime: noSaveTime,
      saved: () {
        if (saved != null) saved();
        _saved(saveNotify);
      },
    );