RxNetDataBase class

author: zhengzaihong email:1096877329@qq.com date: 2023/9/9 time: 12:41 describe: 数据缓存 全平台支持(包括 Web 和 HarmonyOS) 纯 Dart 实现的 NoSQL 数据库,支持所有平台:

  • Android/iOS: 使用文件系统
  • Windows/Linux/macOS: 使用文件系统
  • Web: 使用 IndexedDB
  • HarmonyOS: 使用文件系统(纯 Dart 实现)

Constructors

RxNetDataBase()

Properties

hashCode int
The hash code for this object.
no setterinherited
ready Future<void>
等待数据库初始化完成。
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clean() Future<void>
清空所有数据
count() Future<int>
获取数据库中的记录数量
delete(String key) Future<void>
删除指定键的数据
exists(String key) Future<bool>
检查键是否存在
get<T>(dynamic key) Future<T?>
获取数据
getAllKeys() Future<List<String>>
获取所有键
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(dynamic key, dynamic value) Future
存储数据
setDataBaseReadListener(void function(bool isOk)) → void
数据库还没初始完成,可能已经存在网络请求,先将其缓存;等待数据库完成后并返回数据后,将其全部回调全部清除。 The database has not yet been initially completed, and there may already be network requests. Cache them first; wait for the database to complete and return data, and clear all their callbacks.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](dynamic key) Future
操作符重载:读取数据
operator []=(dynamic key, dynamic value) → void
操作符重载:写入数据

Static Properties

isDatabaseReady bool
getter/setter pair

Static Methods

close() Future<void>
关闭数据库连接
initDatabase({String databaseName = 'rxnet_cache.db', String? cacheName = 'network_cache', String? databasePath}) Future<void>
初始化数据库
waitUntilReady() Future<void>