JsonPreferenceNotify class
JsonPreferences
with notification
- Provide ChangeNotifier for data update and a saveNotifier triggered by save
- Inheritance
-
- Object
- JsonPreference
- JsonPreferenceNotify
- Mixed-in types
Constructors
- JsonPreferenceNotify({required String key, String filenamePrefix = '', int saveWaitSeconds = 0, int saveWaitAgainSeconds = 0})
Properties
- debugLogJson ↔ bool
-
enable/disable fromJson debug log
getter/setter pairinherited
- debugLogJsonContent ↔ bool
-
enable/disable fromJson debug log with content
getter/setter pairinherited
- debugLogSave ↔ bool
-
enable/disable save debug log
getter/setter pairinherited
- filenamePrefix ↔ String
-
Filename prefix when generating filename from keyFilename.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- key → String
-
key for saving preference
finalinherited
- keyFilename → dynamic
-
Generate filename from key
no setterinherited
- lastSaveTime → DateTime
-
Return preference last save time
no setterinherited
-
obj
↔ Map<
String, dynamic> -
JSON object holding all preferences
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
saveNotifier
→ ValueNotifier<
bool> -
final
- saveWaitAgainSeconds ↔ int
-
If save requested came in during wait,
number of seconds to wait again
getter/setter pairinherited
- saveWaitSeconds ↔ int
-
Number of seconds before actually trying to save
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
fromJson(
Map< String, dynamic> jsonObj, {bool debug = false}) → void -
Apply/Clone from json object
override
-
getPref(
) → FutureOr< SharedPreferences> -
Return cached
SharedPreferences
instanceinherited -
load(
{bool forced = false}) → Future< void> -
load preference from local storage
inherited
-
noSave(
Function function) → void -
No-save wrapper
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
save(
{DateTime? dateTime, Function? saved, String debugMsg = '', bool noSaveTime = false, bool saveNotify = true}) → Future< void> -
Save preference to local storage
override
-
toJson(
) → Map< String, dynamic> -
Return a deep copy json object
inherited
-
toString(
) → String -
Return pretty print json
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited