TypedPreferenceStore class

A typed wrapper over SharedPreferencesAsync, keyed by PrefKey.

Centralizes the switch (PrefType) dispatch to the type-specific SharedPreferences accessors, inferring the storage name and value type from the PrefKey itself.

Constructors

TypedPreferenceStore(SharedPreferencesAsync _prefs)
const

Properties

hashCode int
The hash code for this object.
no setterinherited
prefs SharedPreferencesAsync
Exposes the underlying SharedPreferencesAsync for direct, raw key access.
no setter
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
read<T>(PrefKey<T> key) Future<T?>
Reads the value stored for key, or null if absent.
remove(PrefKey key) Future<void>
Removes any value stored for key.
toString() String
A string representation of this object.
inherited
write<T>(PrefKey<T> key, T value) Future<void>
Writes value for key, dispatching on the key's type.

Operators

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