JsonPreference class

Json object with `SharedPreferences

Implementers

Constructors

JsonPreference({required String key, String filenamePrefix = '', int saveWaitSeconds = 0, int saveWaitAgainSeconds = 0})

Properties

debugLogJson bool
enable/disable fromJson debug log
getter/setter pair
debugLogJsonContent bool
enable/disable fromJson debug log with content
getter/setter pair
debugLogSave bool
enable/disable save debug log
getter/setter pair
filenamePrefix String
Filename prefix when generating filename from keyFilename.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
key String
key for saving preference
final
keyFilename → dynamic
Generate filename from key
no setter
lastSaveTime DateTime
Return preference last save time
no setter
obj Map<String, dynamic>
JSON object holding all preferences
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
saveWaitAgainSeconds int
If save requested came in during wait, number of seconds to wait again
getter/setter pair
saveWaitSeconds int
Number of seconds before actually trying to save
getter/setter pair

Methods

fromJson(Map<String, dynamic> jsonObj, {bool debug = false}) → void
Apply/Clone from json object
getPref() FutureOr<SharedPreferences>
Return cached SharedPreferences instance
load({bool forced = false}) Future<void>
load preference from local storage
noSave(Function function) → void
No-save wrapper
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
save({DateTime? dateTime, Function? saved, String debugMsg = '', bool noSaveTime = false}) Future<void>
Save preference to local storage
toJson() Map<String, dynamic>
Return a deep copy json object
toString() String
Return pretty print json
override

Operators

operator ==(Object other) bool
The equality operator.
inherited