Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /
Manage Realm Files

Delete a Realm File - Flutter SDK

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.

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);

Volver

Manage Realm Files

En esta página