【发布时间】:2023-02-05 12:37:31
【问题描述】:
我在我的 flutter 应用程序中使用 Hive 存储数据。当来自 API(airtable)的远程数据发生更改但我的应用程序继续存储旧数据时,我遇到了一些问题。 例如,如何每 1 天自动更新我的应用程序?
有一个我如何使用 Hive 的例子。
await Hive.initFlutter();
var box = await Hive.openBox('wiseBox');
if(box.isEmpty) {
//when my app was open by user at the first
await _save();
}
else {
//repeatedly
await _openCashedData();
}
_save() async {
await box.put('data', 'some_data');
}
_openCashedData() async { // <- can be a synchronous function
await box.get('data');
}
【问题讨论】:
标签: android flutter flutter-hive airtable