PrfDouble class

A type-safe wrapper for storing and retrieving double values in SharedPreferences.

Use this class for storing floating-point numbers like ratings, percentages, coordinates, or any decimal values.

Example:

final userRating = PrfDouble('user_rating', defaultValue: 0.0);
await userRating.set(4.5);
final rating = await userRating.get(); // 4.5
Inheritance

Constructors

PrfDouble.new(String key, {double? defaultValue})
Creates a new double preference variable with the specified key.

Properties

defaultValue double?
Default value to use when no value is stored yet.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
key String
Unique key used to store this variable in SharedPreferences.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getValue(SharedPreferencesAsync prefs) Future<double?>
Retrieves the current value from cache or SharedPreferences.
inherited
isValueNull(SharedPreferencesAsync prefs) Future<bool>
Checks if the current 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 both the cache and SharedPreferences.
inherited
setValue(SharedPreferencesAsync prefs, double value) Future<void>
Saves a new value to SharedPreferences and updates the cache.
inherited
toString() String
A string representation of this object.
inherited

Operators

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