AppStorage class
A wrapper around SharedPreferences for easy and consistent local storage.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
clear(
) → Future< bool> - Clears all values from storage.
-
containsKey(
String key) → bool - Checks if a key exists in storage.
-
getBool(
String key, {bool defaultValue = false}) → bool - Retrieves a bool value from storage.
-
getInt(
String key) → int? - Retrieves an int value from storage.
-
getString(
String key) → String? - Retrieves a String value from storage.
-
init(
) → Future< void> -
Initializes the
SharedPreferencesinstance. Should be called inmain()before using any other methods. -
read<
T> (String key) → T? - Retrieves a value from storage.
-
remove(
String key) → Future< bool> - Removes a value from storage.
-
saveBool(
String key, bool value) → Future< bool> - Saves a bool value to storage.
-
saveInt(
String key, int value) → Future< bool> - Saves an int value to storage.
-
saveString(
String key, String value) → Future< bool> - Saves a String value to storage.
-
write(
String key, dynamic value) → Future< void> - Alias for saveString or other type-specific savers.