ObjectBox Flutter: Clear all the tables on logout

Issue

I am using ObjectBox for the database and I have created a couple of tables. Now I need to clear all the tables (like truncate to start primary id from 1 again) like Clean the Database.

I didn’t found any method or way to clear the database.

I thought to use removeAll for all the tables, but I think it’s not the proper way.

Please do let me know if is there any other way to do it.

Thanks,
Pratik.

Solution

What you’re trying to do seems like you want to start the database from scratch. In that case, you can delete the database directory before initializing Store().

Answered By – vaind

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *