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(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(SharedPreferences prefs) → Future<double?>
Retrieves the current value from cache or SharedPreferences.
inherited
isValueNull(SharedPreferences 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(SharedPreferences prefs) → Future<void>
Removes the value from both the cache and SharedPreferences.
inherited
setValue(SharedPreferences prefs, double value) → Future<bool>
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