样本
deleteItem(int index) {
final box = Hive.box<Delivery>("deliveries");
box.deleteAt(index);
}
我想将 index 参数更改为我的对象的 id),就像这样
deleteItem(int id) {
final box = Hive.box<Delivery>("deliveries");
// box.deleteAt(index);
// box delete by id here
}
这是我的 TypeAdapter 类:
@HiveType(typeId: 0)
class Delivery {
@HiveField(0)
final int id;
Delivery(this.id);
}