PrfService class abstract
Service for accessing and managing SharedPreferences.
This singleton service provides access to the SharedPreferencesAsync
instance
used by the PRF library, with support for testing through override functionality
and migration from legacy SharedPreferences.
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
- instance → SharedPreferencesAsync
-
Returns the singleton instance of SharedPreferencesAsync.
no setter
- isInitialized → bool
-
no setter
- maybePrefs → SharedPreferences?
-
no setter
Static Methods
-
clear(
{Set< String> ? allowList}) → Future<void> -
Clears all
SharedPreferences
values. Optionally pass anallowList
to retain specific keys. -
getInstance(
) → Future< SharedPreferences> -
migrateFromLegacyPrefsIfNeeded(
{String migrationKey = 'prf_migrated'}) → Future< void> - Migrates data from legacy SharedPreferences to SharedPreferencesAsync.
-
overrideWith(
SharedPreferencesAsync prefs) → void - Overrides the default SharedPreferencesAsync instance.
-
reset(
) → void -
resetOverride(
) → void - Resets any override, allowing the default instance to be used.