适用于 Flutter 的官方 Realm SDK。Realm 是一个移动数据库,是 SQLite 和键值存储的替代方案
当前项目代码仓暂无内容
realm
本项目基于 realm 开发。
1. 安装与使用
1.1 安装方式
进入到工程目录并在 pubspec.yaml 中添加以下依赖:
pubspec.yaml
...
dependencies:
realm:
git:
url: https://gitcode.com/CPF-Flutter/fluttertpc_realm
path: packages/realm
# ref: Please select the TAG to the TAG Version Mapping
ref: realm-20.1.1-ohos-1.0.0
...
执行命令
flutter pub get
TAG 版本对应表
| Flutter 框架版本 | TAG | 分支 |
|---|---|---|
| 3.7 | - | - |
| 3.22 | - | - |
| 3.27 | realm-20.1.1-ohos-1.0.0 | main |
| 3.35 | realm-20.1.1-ohos-1.0.0 | main |
1.2 使用案例
使用案例详见 example
2. 约束与限制
2.1 兼容性
在以下版本中已测试通过
- Flutter: 3.27.5-ohos-1.0.1; SDK: 5.0.0(12); IDE: DevEco Studio: 5.1.0.828; ROM: 5.1.0.130 SP8;
- Flutter: 3.35.7-ohos-0.0.1; SDK: 6.0.1(21); IDE: DevEco Studio: 6.0.1.260; ROM: 6.0.0.120 SP6;
3. API
"ohos Support"列为 yes 表示 ohos 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
realm
| Name | Description | Type | Input | Output | ohos Support |
|---|---|---|---|---|---|
| write | 在写入事务中同步调用提供的回调。 | function | 无 | Future | yes |
| add | 添加 | function | RealmObject | Future | yes |
| all | 返回所有RealmObject数据 | function | RealmObject | Future | yes |
| all<>().query | 根据条件过滤数据 | function | RealmObject | Future | yes |
4. 遗留问题
无
5. 开源协议
本项目基于 The MIT License,请自由地享受和参与开源。