In some cases, you may want to completely delete a realm file from disk.
Realm avoids copying data into memory except when absolutely required. As a result, all objects managed by a realm have references to the file on disk. Before you can safely delete the file, you must ensure the deallocation of these objects:
All objects read from or added to the realm
All List and Results objects
All ThreadSafeReference objects
The realm itself
Advertencia
No borrar archivos mientras los reinos estén abiertos
If you delete a realm file or any of its auxiliary files while one or more instances of the realm are open, you might corrupt the realm or disrupt sync.
Delete a Realm File
Puedes eliminar el .realm, .note y .management archivos para una configuración dada con el método estático Realm.deleteRealm(), que acepta una ruta a un archivo de reino como argumento.
//Get realm's file path final path = realm.config.path; // You must close a realm before deleting it realm.close(); // Delete the realm Realm.deleteRealm(path);