如何在Flutter应用中最佳地本地存储和处理大型数据集

时间:2020-06-24 14:06:04

标签: database flutter hive

我目前正在构建一个Flutter应用程序,其中包含更大的数据集(例如2000-10000条文本)。 我对Flutter开发相对较新,因此我不知道哪种数据库最适合这种情况。

该应用程序无需连接到互联网,下载后所有数据都在设备上。 您只需要广泛地查询此数据,并立即从中构建数据集即可。

我做了一些研究,但是最常用的数据库(配置单元)似乎不适合我的需求。

如果有人可以提供帮助,我将不胜感激。

1 个答案:

答案 0 :(得分:0)

似乎 ObjectBox 最适合大数据,它的表现非常好

[Check this package best suits for your data][1]
import 'package:objectbox/objectbox.dart';
class Note {
  // Each "Entity" needs a unique integer ID property.
  // Add `@Id()` annotation if its name isn't "id" (case insensitive).
  int id = 0;

  String? text;

  DateTime date;

  @Transient() // Make this field ignored, not stored in the database.
  int? notPersisted;

  // An empty default constructor is needed but you can use optional args.
  Note({this.text, DateTime? date}) : date = date ?? DateTime.now();

  // Note: just for logs in the examples below(), not needed by ObjectBox.
  toString() => 'Note{id: $id, text: $text}';
}```