PrfString class
A cached preference object for String values.
This class is deprecated. Use Prf instead.
Example:
final username = Prf<String>('username');
- Inheritance
-
- Object
- BasePrfObject<
String> - CachedPrfObject<
String> - Prf<
String> - PrfString
- Annotations
-
- @Deprecated('Use Prf instead. This class will be removed in a future version.')
Constructors
- PrfString.new(String key, {String? defaultValue})
- Creates a new cached String preference.
Properties
-
adapter
→ PrfAdapter<
String> -
The adapter used to convert between the type
T
and SharedPreferences.no setterinherited - cachedValue → String?
-
Returns the currently cached value without accessing SharedPreferences.
no setterinherited
- defaultValue → String?
-
Optional default value to use when no value exists for key.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
isolated
→ PrfIso<
String> -
Creates an isolate-safe version of this preference.
no setterinherited
- key → String
-
The key used to store this preference in SharedPreferences.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getValue(
SharedPreferencesAsync prefs) → Future< String?> -
Gets the value, using the cached value if available or reading from storage if not.
inherited
-
init(
) → Future< void> -
Initializes the cache by loading the current value from storage.
inherited
-
initCache(
SharedPreferencesAsync prefs) → Future< void> -
Initializes the cache by reading the current value from SharedPreferences.
inherited
-
isValueNull(
SharedPreferencesAsync prefs) → Future< bool> -
Checks if the stored value is null.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeValue(
SharedPreferencesAsync prefs) → Future< void> -
Removes the value from SharedPreferences and clears the cached value.
inherited
-
setValue(
SharedPreferencesAsync prefs, String value) → Future< void> -
Stores
value
in SharedPreferences and updates the cached value.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited