I try to figure out how to delete all created files from ObjectBox. During my unittest ObjectBox creates the needed files in the directory that I'm giving it on my local machine. After the unittest I want that ObjectBox deletes all the created files. How is that possible? I have seen in post like this one (How to close Objectbox Store and delete data files), that in JAVA is a "deleteAllFiles" method. For Flutter/Dart I can't find that one.


Solution 1: Swisscheese

If you want to delete the files you can do something like

 void deleteDbFiles() async {
Directory docDir = await getApplicationDocumentsDirectory();
Directory(docDir.path + '/db_name').delete();

}

Or you can use this, which would delete the entire directory (not recommended, only use if you're not using the default directory)

docDir.deleteSync(recursive: true);