DataSave class

Constructors

DataSave()

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

getBool(String key) → bool?
getDouble(String key) → double?
getInt(String key) → int?
getKeys() → Set<String>
Returns a snapshot of stored keys. On web, this includes readable cookies and localStorage keys, or in-memory large-string keys if storage is blocked.
getLargeString(String key) → String?
Reads a value written with setLargeString.
getString(String key) → String?
getStringList(String key) → List<String>?
Reads a value written with setStringList, or null if the key is missing.
init({String? windowsPreferencesFilePath}) → Future<void>
Loads preferences. On Windows, a FormatException during loading deletes the shared_preferences.json file opened by the Windows backend. All its values are lost. The error is rethrown; restart to load empty preferences. windowsPreferencesFilePath can override the detected path, but is not needed for the default storage location. Other platforms ignore it.
remove(String key) → Future<bool>
Returns whether removal succeeded, including when the key was absent. Empty keys return false. Native backend errors can still throw; on web, blocked storage or a value that remains after removal returns false.
removeAll() → Future<void>
removeAllLarge() → Future<void>
setBool(String key, bool value) → Future<void>
setDouble(String key, double value) → Future<void>
setInt(String key, int value) → Future<void>
setLargeString(String key, String value) → Future<void>
Stores a larger string in localStorage on web and SharedPreferences on native platforms.
setString(String key, String value) → Future<void>
setStringList(String key, List<String> value) → Future<void>
Stores a string list. On web, the JSON-encoded list uses a cookie and is subject to the same size limit as setString.