Realm class Null safety Realm

A Realm instance represents a Realm database.


Realm(Configuration config)
Opens a Realm using a Configuration object.


config Configuration
The Configuration object used to open this Realm
hashCode int
The hash code for this object.
read-only, inherited
isClosed bool
Checks whether the Realm is closed.
isInTransaction bool
Checks whether the Realm is in write transaction.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
subscriptions SubscriptionSet
The active SubscriptionSet for this Realm
syncSession Session
The Session for this Realm. The sync session is responsible for two-way synchronization with MongoDB Atlas. If the Realm is not synchronized, accessing this property will throw.


add<T extends RealmObject>(T object) → T
Adds a RealmObject to the Realm.
addAll<T extends RealmObject>(Iterable<T> items) → void
Adds a collection RealmObjects to this Realm.
all<T extends RealmObject>() RealmResults<T>
Returns all RealmObjects of type T in the Realm
close() → void
Closes the Realm.
delete<T extends RealmObject>(T object) → void
Deletes a RealmObject from this Realm.
deleteAll<T extends RealmObject>() → void
Deletes all RealmObjects of type T in the Realm
deleteMany<T extends RealmObject>(Iterable<T> items) → void
Deletes many RealmObjects from this Realm.
find<T extends RealmObject>(Object primaryKey) → T?
Fast lookup for a RealmObject with the specified primaryKey.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
query<T extends RealmObject>(String query, [List<Object> args = const []]) RealmResults<T>
Returns all RealmObjects that match the specified query.
toString() String
A string representation of this object.
write<T>(T writeCallback()) → T
Synchronously calls the provided callback inside a write transaction.


operator ==(Object other) bool
The equality operator.

Static Properties

logger Logger
The logger to use for logging
read / write

Static Methods

deleteRealm(String path) → void
Deletes all files associated with a Realm located at given path
exists(String path) Future<bool>
Checks whether a Realm exists at path.
existsSync(String path) bool
Synchronously checks whether a Realm exists at path
shutdown() → void
Used to shutdown Realm and allow the process to correctly release native resources and exit.