ChicoPrefs class abstract final

Lightweight prefs for flags and small settings (not secrets).

Call init once from main (or ChicoServices.init).

await ChicoPrefs.init();
await ChicoPrefs.setBool('onboarding_done', true);
final done = ChicoPrefs.getBool('onboarding_done');

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

isReady → bool
Whether init has completed.
no setter

Static Methods

clear() → Future<bool>
Clears all prefs for this app.
getBool(String key, [bool fallback = false]) → bool
Bool for key, or fallback.
getDouble(String key, [double fallback = 0]) → double
Double for key, or fallback.
getInt(String key, [int fallback = 0]) → int
Int for key, or fallback.
getString(String key, [String fallback = '']) → String
String for key, or fallback.
getStringList(String key) → List<String>
String list for key, or empty.
init() → Future<void>
Loads the platform prefs instance.
remove(String key) → Future<bool>
Removes key.
setBool(String key, bool value) → Future<bool>
Writes a bool.
setDouble(String key, double value) → Future<bool>
Writes a double.
setInt(String key, int value) → Future<bool>
Writes an int.
setString(String key, String value) → Future<bool>
Writes a string.
setStringList(String key, List<String> value) → Future<bool>
Writes a string list.