Prefs class

Core class for managing preferences with local, remote, and volatile storage.

This class handles loading, caching, and saving preferences across different storage types. All operations are cached in memory for fast access.

Constructors

Prefs()

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 Methods

get<T>(String key, {required T defaultValue}) → T
Gets a preference value from the cache.
loadPreferences(Map<String, PrefType> preferences) → Future<void>
Loads all preferences into the in-memory cache.
reloadRemotePreferences() → Future<bool>
Manually triggers a remote preferences reload.
set<T>(String k, T v, {required PrefType type}) → Future<void>
Sets a preference value and updates the cache.
setConnectivityChecker(ConnectivityChecker? checker) → void
Configures a connectivity checker for smarter retry logic.
setLogger(PrefsLogger logger) → void
Configures the logger for preference operations.
setMaxRetries(int maxRetries) → void
Configures the maximum number of retries for loading remote preferences.
setRemoteLoadCallback(RemoteLoadCallback? callback) → void
Configures a callback to be notified when remote preferences load.
setRemotePreferences(RemotePrefs remotePrefs) → void
Configures the remote preferences implementation.