Prf class abstract

Singleton wrapper around SharedPreferencesAsync for use in the prf package.

This service provides isolate-safe, always up-to-date access to the native storage without relying on any underlying SharedPreferences cache. prf handles its own in-memory caching on top of this.

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
The active SharedPreferencesAsync instance.
no setter
isInitialized bool
Checks if SharedPreferences has been initialized.
no setter
maybePrefs → SharedPreferences?
Provides synchronous access to the cached SharedPreferences instance.
no setter

Static Methods

clear({Set<String>? allowList}) Future<void>
Clears all SharedPreferences values. Optionally pass an allowList to retain specific keys.
getInstance() Future<SharedPreferences>
Gets the SharedPreferences instance, initializing it if necessary.
migrateFromLegacyPrefsIfNeeded({String migrationKey = 'prf_migrated'}) Future<void>
Migrates data from legacy SharedPreferences to SharedPreferencesAsync.
overrideWith(SharedPreferencesAsync prefs) → void
Override the internal SharedPreferencesAsync instance (for testing).
reset() → void
Resets the cached SharedPreferences instance and initialization state.
resetOverride() → void
Resets any test override and restores the default instance.