SPUtils class abstract

Constructors

SPUtils()

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 Properties

allKayValueMap Map<String, dynamic>
获取存储的所有值
no setter
spInstance → SharedPreferences
no setter

Static Methods

clear() Future<bool>
清除sp
forEach(SPKeyValueCallBack callBack) → void
遍历sp
getBool(String? key, {bool defValue = false}) bool
获取sp中key的布尔值
getDouble(String? key, {double defValue = 0.0}) double
获取sp中key的double值
getInt(String? key, {int defValue = 0}) int
获取sp中key的int值
getObject(String? key, {Map defValue = const {}}) Map
获取sp中key的map数据
getObjectList(String? key, {List<Map> defValue = const []}) List<Map>
获取sp中key的list集合
getString(String? key, {String defValue = ""}) String
获取sp中key的字符串
getStringList(String? key, {List<String> defValue = const []}) List<String>
获取sp中key的list
getStringMap(String? key, {Map defValue = const {}}) Map
获取sp中key的map值
hasKey(String? key) bool
判断是否存在key的数据
initSP() Future<void>
必须在使用之前调用
putBool(String? key, bool? value) Future<bool>
存储sp中key的布尔值
putDouble(String? key, double? value) Future<bool>
存储sp中key的double值
putInt(String? key, int? value) Future<bool>
存储sp中key的int值
putObject(String? key, Object? value) Future<bool>
存储object类型数据
putObjectList(String? key, List<Object>? list) Future<bool>
存储sp中key的list集合
putString(String? key, String? value) Future<bool>
存储sp中key的字符串
putStringList(String? key, List<String>? value) Future<bool>
put string list. 存储sp中key的list
putStringMap(String? key, Map? value) Future<bool>
存储sp中key的map值
remove(String? key) Future<bool>
移除sp中key的值