Reputation: 164
How I can delete value of List in flutter Hive ??
example list = [
record(
name: 'john',
class: 'Coffee',
),
record(
name: 'sarah',
class: 'Coffee',
),
record(
name: 'rala',
class: 'Water',
),
];
as you can see I have multiple value and want to delete all record that contains value of coffee but Hive dnt have such as function that can do that
edit: Iam using Box.add function to add value using auto increment key Iam thingking about delete all the box in hivedb and putAll updated list in var to Hive but iam open to other more effective way or advice
thanks for those who read this
Upvotes: 0
Views: 352
Reputation: 164
so I reached Hive repo according to this https://github.com/hivedb/hive/issues/738 and I also want to share my code if there are someone need if ur need is like me
List<BudgetCard> listDelete = localBudget.values.toList();
for (int i = 0; i < listDelete.length; i++) {
if (listDelete[i].budgetWallet == walletID) {
localBudget.deleteAt(i);
}
}
Thank you for all who respond to my Question!!
Upvotes: 0
Reputation: 17311
Hive
doesn't have removeWhere
and you should use Dart
methods to do something
Upvotes: 1