SharedPrefsUtils class

Name: SP工具类 基于 shared_preferences Created by Fitem on 2023/5/31

Constructors

SharedPrefsUtils()

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 defValue = false]) Future<bool>
获取bool类型数据,如果没有则返回默认值 keydefValue 默认值:默认为false
getDouble(String key, [double defValue = 0.0]) Future<double>
获取double类型数据,如果没有则返回默认值 keydefValue 默认值:默认为0.0
getInt(String key, [int defValue = 0]) Future<int>
获取int类型数据,如果没有则返回默认值 keydefValue 默认值:默认为0
getString(String key, [String defValue = '']) Future<String>
获取String类型数据 keydefValue 默认值:默认为空字符串
getStringList(String key, [List<String> defValue = const []]) Future<List<String>>
获取List
putBool(String key, bool value) Future<void>
添加bool类型数据 keyvalue
putDouble(String key, double value) Future<void>
添加double类型数据 keyvalue
putInt(String key, int value) Future<void>
添加int类型数据 keyvalue
putString(String key, String value) Future<void>
添加String类型数据 keyvalue
putStringList(String key, List<String> value) Future<void>
添加List