ElStorageService class
Constructors
- ElStorageService({String rootFolder = 'flutter_element_data', String storageName = 'el_storage'})
-
单例工程构造方法,若要自定义本地存储文件夹,只需在 El.init 调用前构建此类即可,
例如:
factory
Properties
- appDirectory → Directory
-
应用本地存储目录(此目录存放的是应用全局配置信息,它不能用来存放用户数据)
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- rootFolder → String
-
默认的本地根目录文件夹
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- storageName → String
-
默认的存储库名字,即 localStorage、
sessionStorage的默认存储名字final -
storages
→ Map<
String, ElStorage> -
记录创建的存储对象集合
final
Methods
-
createStorage(
[String? key]) → Future< ElStorage> - 创建独立的存储对象,你可以指定不同的 key 创建多个隔离的存储对象
-
getDirectory(
Directory prefixDir, String dir, {String? folder}) → Directory - 获取 Directory 目录,此方法会自动拼接 rootFolder 文件夹
-
getFile(
Directory prefixDir, String name, {String? folder}) → File - 获取 File 文件,此方法会自动拼接 rootFolder 文件夹
-
initStorage(
) → Future< void> - 初始化本地存储数据
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeStorage(
String key) → Future< bool> - 移除本地存储对象,此方法只移除本地存储文件,一旦移除你将不可以再使用当前 ElStorage 对象, 否则序列化会失败,
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited