Clear boxes
- Dominant language
- Dart
- Stars
- 4.4k
- Forks
- 449
- PR merge metrics
- No merged PRs in 30d
Description
**Question**
Hi guys, what I want to do is delete all the data from the boxes and start saving data again. I did the next method to reset the boxes, but I get this error: "the box has been closed".
How could I re-open the boxes once they are closed or how to complete clear boxes and memory ?
Thank you very much for your answers : )
**Code sample**
```
Future resetBoxes() async {
// clear
await usersBOX.clear();
await expensesBOX.clear();
// compact
await usersBOX.compact();
await expensesBOX.compact();
// close
await Hive.close();
// re open boxes
await Hive.openBox('USERS-BOX');
await Hive.openBox('EXPENSE-BOX');
}
```
**Version**
- Platform: Android
- Flutter version: 2.5
- Hive version: 2.0.4
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.