objectbox-dart
objectbox-dart copied to clipboard
Delete the store data with single function.
We have removeAll functionality for the individual boxes. Do we also have something like this for the entire store, such that all the data from all the boxes is deleted?
And if I have to run them in transaction and there are many entities. I am doing it like this now.
_db.store.runInTransaction(TxMode.write, () {
_db.store.box<Shape1>().removeAll();
_db.store.box<Shape2>().removeAll();
});
Could there be a better way to do this ?
BTW: If you didn't want to keep any data, i.e. not even last object IDs (auto-increments), you can delete the database directory. This would also be the fastest thing to do if you want to remove the whole database.
Still, providing store.removeAll() sounds reasonable.
Edit: the Java implementation. Not sure if the C library has a function for this (yet).
@raphire08 You're always free to write your own dart extensions for whatever functionality you feel is missing.