KeyValueStorage class abstract

键值存储抽象接口,解耦 MMKV 原生依赖以支持单元测试。

Implementers

Constructors

KeyValueStorage()

Properties

allKeys → List<String>
当前存储中的全部键。
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearAll() → void
清空存储中的全部键值。
getBool(String key, {bool defaultValue = false}) → bool
读取 key 的 bool 值;不存在时返回 defaultValue。
getDouble(String key, {double defaultValue = 0.0}) → double
读取 key 的 double 值;不存在时返回 defaultValue。
getInt(String key, {int defaultValue = 0}) → int
读取 key 的 int 值;不存在时返回 defaultValue。
getString(String key) → String?
读取 key 的字符串值;不存在时返回 null。
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeValue(String key) → void
删除 key 对应的值。
removeValues(List<String> keys) → void
批量删除 keys 对应的值。
setBool(String key, bool? value) → bool
将 value 存入 key;成功返回 true。
setDouble(String key, double? value) → bool
将 value 存入 key;成功返回 true。
setInt(String key, int? value) → bool
将 value 存入 key;成功返回 true。
setString(String key, String? value) → bool
将 value 存入 key;成功返回 true。
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited