LocalStorageUtil class Null safety

本地Key:Value存储工具类

Constructors

LocalStorageUtil()
factory

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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>
清除所有持久化数据
containsKey(String key) bool
获取持久化数据中是否包含某个key
getBool(String key, {bool defaultValue = false}) bool
根据key获取布尔类型
getDouble(String key, {double defaultValue = 0.0}) double
根据key获取double类型
getInt(String key, {int defaultValue = 0}) int
根据key获取int类型
getKeys() Set<String>
获取持久化数据中所有存入的key
getLocalStorage<T>(String key) → dynamic
获取持久化数据
getMap(String key) Map
根据key获取Map类型
getString(String key, {String defaultValue = ""}) String
根据key获取字符串类型
getStringList(String key, {List<String> defaultValue = const []}) List<String>
根据key获取字符串类型数组
instance() Future<LocalStorageUtil>
reload() Future<void>
重新加载所有数据,仅重载运行时
remove(String key) Future<bool>
删除持久化数据中某个key
setBool(String key, bool value) Future<bool>
根据key存储布尔类型
setDouble(String key, double value) Future<bool>
根据key存储double类型
setInt(String key, int value) Future<bool>
根据key存储int类型
setLocalStorage<T>(String key, T value) → dynamic
通用设置持久化数据
setMap(String key, Map value) Future<bool>
根据key存储Map类型
setString(String key, String value) Future<bool>
根据key存储字符串类型
setStringList(String key, List<String> value) Future<bool>
根据key存储字符串类型数组