SharedPrefsStorage class

A TimerStorage implementation that uses the shared_preferences package.

This class handles the physical reading and writing of integer values to the device's local disk, ensuring that timer data persists even if the app process is terminated.

Implemented types

Constructors

SharedPrefsStorage({required String key})
Creates a SharedPrefsStorage instance with a specific key.

Properties

hashCode → int
The hash code for this object.
no setterinherited
key → String
The unique identifier used to store and retrieve data from SharedPreferences.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → Future<void>
Removes the value associated with the assigned key from the device's persistent storage.
override
loadSeconds() → Future<int?>
Reads the stored integer value from the device's disk.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
saveSeconds(int seconds) → Future<void>
Writes the provided seconds to the device's persistent storage using the assigned key.
override
toString() → String
A string representation of this object.
inherited

Operators

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