BasePrfObject<T> class abstract

Base class for preference objects that provides core functionality for storing and retrieving typed values from SharedPreferences.

This class handles the persistence layer for preference objects, working with SharedPreferencesAsync and using PrfAdapters for type conversion.

Implementers
Available extensions

Constructors

BasePrfObject.new(String key, {T? defaultValue})
Creates a new preference object with the given key and optional defaultValue.
const

Properties

adapter PrfAdapter<T>
The adapter used to convert between the type T and SharedPreferences.
no setter
defaultValue → T?
Optional default value to use when no value exists for key.
final
hashCode int
The hash code for this object.
no setterinherited
key String
The key used to store this preference in SharedPreferences.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

existsOnPrefs() Future<bool>

Available on BasePrfObject<T>, provided by the PrfOperationExtensions extension

Checks if the key exists in the default PrfService instance.
get() Future<T?>

Available on BasePrfObject<T>, provided by the PrfOperationExtensions extension

Gets the value from the default PrfService instance.
getOrFallback(T fallback) Future<T>

Available on BasePrfObject<T>, provided by the PrfOperationExtensions extension

Gets the value or returns the provided fallback if the value is null.
getValue(SharedPreferencesAsync prefs) Future<T?>
Gets the value from SharedPreferences.
isNull() Future<bool>

Available on BasePrfObject<T>, provided by the PrfOperationExtensions extension

Checks if the value is null in the default PrfService instance.
isValueNull(SharedPreferencesAsync prefs) Future<bool>
Checks if the stored value is null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove() Future<void>

Available on BasePrfObject<T>, provided by the PrfOperationExtensions extension

Removes the value from the default PrfService instance.
removeValue(SharedPreferencesAsync prefs) Future<void>
Removes the value from SharedPreferences.
set(T value) Future<void>

Available on BasePrfObject<T>, provided by the PrfOperationExtensions extension

Sets the value using the default PrfService instance.
setValue(SharedPreferencesAsync prefs, T value) Future<void>
Stores value in SharedPreferences.
toString() String
A string representation of this object.
inherited

Operators

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