realm library

Classes

ApiKey
A class representing an API key for a User. It can be used to represent the user when logging in instead of their regular credentials. These keys are created or fetched through User.apiKeys.
ApiKeyClient
A class exposing functionality for users to manage API keys from the client. It is always scoped to a particular User and can only be accessed via User.apiKeys
App Application
An App is the main client-side entry point for interacting with an Atlas App Services application.
AppConfiguration Application
A class exposing configuration options for an App
Indicates that the field it decorates is the inverse end of a relationship.
CancellationToken
A token for controlling the cancellation of Cancellable operations.
ClientResetHandler Sync
ClientResetHandler is triggered if the device and server cannot agree on a common shared history for the realm file or when it is impossible for the device to upload or receive any changes. This can happen if the server is rolled back or restored from backup.
CompensatingWriteInfo Sync
Contains the details for a compensating write performed by the server.
Configuration Configuration
Configuration used to create a Realm instance
ConnectionStateChange
A type containing information about the transition of a connection state from one value to another.
Credentials Application
A class, representing the credentials used for authenticating a User
Decimal128
A 128-bit decimal floating point number.
Defined<T>
DiscardUnsyncedChangesHandler Sync
A client reset strategy where any not yet synchronized data is automatically discarded and a fresh copy of the synchronized realm is obtained.
DisconnectedSyncConfiguration Configuration
DisconnectedSyncConfiguration is used to open Realm instances that are synchronized with MongoDB Atlas, without establishing a connection to Atlas App Services. This allows for the synchronized realm to be opened in multiple processes concurrently, as long as only one of them uses a FlexibleSyncConfiguration to sync changes.
DynamicRealm Realm
Exposes a set of dynamic methods on the Realm object. These don't use strongly typed classes and instead lookup objects by string name.
DynamicRealmObject Realm
Exposes a set of dynamic methods on the RealmObject type. These allow you to access properties by name rather than via the strongly typed API.
EJson<T>
Annotation to mark a class for extended json (ejson) serialization
EmailPasswordAuthProvider Application
A class, encapsulating functionality for users, logged in with Credentials.emailPassword(). It is always scoped to a particular app.
FlexibleSyncConfiguration Configuration
FlexibleSyncConfiguration is used to open Realm instances that are synchronized with MongoDB Atlas.
FunctionsClient
A class exposing functionality for calling remote Atlas Functions.
GeoBox
A box on the earth's surface.
GeoCircle
A circle on the earth's surface.
GeoDistance
An equatorial distance on earth's surface.
GeoPoint
A point on the earth's surface.
GeoShape
A base type for the supported geospatial shapes.
Ignored Annotations
Indicates an ignored property.
Indexed Annotations
Indicates an indexed property.
InMemoryConfiguration Configuration
InMemoryConfiguration is used to open Realm instances that are temporary to running process.
LocalConfiguration Configuration
LocalConfiguration is used to open local Realm instances, that are persisted across runs.
LogCategory
ManualRecoveryHandler Sync
A client reset strategy where the user needs to fully take care of a client reset.
MapTo Annotations
MapTo annotation for class level and class member level.
Migration Realm
A Migration object is passed to you when you migrate your database from one version to another. It contains the properties for the Realm before and after the migration. After the migration is complete, newRealm will become the authoritative version of the file.
MigrationRealm Realm
A class used during a migration callback. It exposes a set of dynamic API as well as the Realm config and schema.
Move
Contains index information about objects that moved within the same collection.
MutableSubscriptionSet Sync
A mutable view to a SubscriptionSet. Obtained by calling SubscriptionSet.update.
ObjectId
ObjectId
PrimaryKey Annotations
Indicates a primary key property.
Realm Realm
A Realm instance represents a Realm database.
RealmList<T extends Object?> Realm
Instances of this class are live collections and will update as new elements are either added to or deleted from the collection or from the Realm.
RealmListChanges<T extends Object?>
Describes the changes in a Realm list collection since the last time the notification callback was invoked.
RealmLogger
A logger that logs messages from the Realm SDK.
RealmMap<T extends Object?>
RealmMap is a collection that contains key-value pairs of <String, T>.
RealmMapChanges<T extends Object?>
Describes the changes in a Realm map collection since the last time the notification callback was invoked.
RealmModel Annotations
Annotation class used to define Realm data model classes and their properties
RealmObjectChanges<T extends RealmObjectBase>
Describes the changes in on a single RealmObject since the last time the notification callback was invoked.
RealmResults<T extends Object?> Realm
Instances of this class are live collections and will update as new elements are either added to or deleted from the Realm that match the underlying query.
RealmResultsChanges<T extends Object?>
Describes the changes in a Realm results collection since the last time the notification callback was invoked.
RealmSchema Configuration
Describes the complete set of classes which may be stored in a Realm
RealmSchemaChanges
Describes the schema changes that occurred on a Realm
RealmSet<T extends Object?>
RealmSet is a collection that contains no duplicate elements.
RealmSetChanges<T extends Object?>
Describes the changes in a Realm set collection since the last time the notification callback was invoked.
RealmValue
A type that can represent any valid realm data type, except embedded objects.
RecoverOrDiscardUnsyncedChangesHandler Sync
A client reset strategy that attempts to automatically recover any unsynchronized changes. If that fails, this handler fallsback to the discard unsynced changes strategy.
RecoverUnsyncedChangesHandler Sync
A client reset strategy that attempts to automatically recover any unsynchronized changes.
SchemaObject Configuration
A collection of properties describing the underlying schema of a RealmObjectBase.
SchemaProperty Configuration
Describes a property on RealmObjectBase with its name, type and other attributes in the RealmSchema
Session Sync
An object encapsulating a synchronization session. Sessions represent the communication between the client (and a local Realm file on disk), and the server. Sessions are always created by the SDK and vended out through various APIs. The lifespans of sessions associated with Realms are managed automatically.
Subscription Sync
A class representing a single query subscription. The server will continuously evaluate the query that the app subscribed to and will send data that matches it as well as remove data that no longer does.
SubscriptionSet Sync
A collection representing the set of active subscriptions for a Realm instance.
SyncProgress
A type containing information about the progress state at a given instant.
TimeoutCancellationToken
A CancellationToken that automatically cancels after a given duration.
Transaction
Provides a scope to safely write data to a Realm. Can be created using Realm.beginWrite or Realm.beginWriteAsync.
Undefined<T>
UndefinedOr<T>
User Application
This class represents a user in an Atlas App Services application. A user can log in to the server and, if access is granted, it is possible to synchronize the local Realm to MongoDB Atlas. Moreover, synchronization is halted when the user is logged out. It is possible to persist a user. By retrieving a user, there is no need to log in again. Persisting a user between sessions, the user's credentials are stored locally on the device, and should be treated as sensitive data.
UserChanges
Describes the changes to a User instance - for example when the access token is updated or the user state changes. Right now, this only conveys information that the user has changed, but in the future it will be enhanced by adding details about the exact properties that have been updated.
UserIdentity
The user identity associated with a User
Uuid
Represents a RFC 4122 UUID. More generally, any 128-bit byte sequence can be represented by this class, but the semantics for the fields described in the may not apply for other variants.

Enums

AuthProviderType Application
An enum containing all authentication providers. These have to be enabled manually for the application before they can be used. Authentication Providers Docs
BsonKey
See MaxKey and MinKey
ConnectionState
The current connection state of a Session object
EJsonType
IntFormat
LogLevel Realm
Specifies the criticality level above which messages will be logged by the default sync client logger.
MetadataPersistenceMode Application
Specify if and how to persists user objects.
ObjectType Annotations
An enum controlling the base type for a RealmModel.
ProgressDirection
The transfer direction (upload or download) tracked by a given progress notification subscription.
ProgressMode
The desired behavior of a progress notification subscription.
RealmCollectionType Configuration
All supported Realm collection types.
RealmIndexType
Describes the indexing mode for properties annotated with the @Indexed annotation.
RealmPropertyType Configuration
All supported Realm property types.
RealmValueType
An enum describing the possible types that can be wrapped inside RealmValue
SessionState
The current state of a Session object
SubscriptionSetState Sync
SyncErrorCode
Error code enumeration, indicating the type of SyncError.
UserState
The current state of a User.
WaitForSyncMode
Behavior when waiting for subscribed objects to be synchronized/downloaded.

Mixins

AsymmetricObject
Base for any object that can be persisted in a Realm, but cannot be retrieved, hence cannot be modified.
RealmEntity
RealmObjectBase Realm
An object that is persisted in Realm.

Constants

ejson → const EJson
Annotation to mark a class for extended json (ejson) serialization
undefined → const Undefined

Properties

relaxed bool
Whether to use relaxed encoding or not, default is false
getter/setter pair

Functions

fromEJson<T>(EJsonValue? ejson) → T
Converts ejson to type T.
fromEJsonString<T>(String source) → T
Parses source to EJsonValue and convert to type T.
register<T>(EJsonEncoder<T> encoder, EJsonDecoder<T> decoder) → void
Register custom EJSON encoder and decoder for a type T. The last registered codec pair for a given type T will be used.
toEJson(Object? value) EJsonValue?
Converts value to EJson
toEJsonString(Object? value) String
Converts value to EJson string

Typedefs

AfterResetCallback = FutureOr<void> Function(Realm beforeResetRealm, Realm afterResetRealm)
Callback that indicates a Client Reset has just happened.
BeforeResetCallback = FutureOr<void> Function(Realm beforeResetRealm)
Callback that indicates a Client Reset is about to happen.
ClientResetCallback = FutureOr<void> Function(ClientResetError clientResetError)
The signature of a callback that will be triggered when a Client Reset error happens in a synchronized Realm.
EJsonDecoder<T> = T Function(EJsonValue? ejson)
EJsonEncoder<T> = EJsonValue? Function(T object)
EJsonValue = Object?
GeoRing = List<GeoPoint>
InitialDataCallback = void Function(Realm realm)
The signature of a callback that will be executed only when the Realm is first created.
LogRecord = ({LogCategory category, LogLevel level, String message})
A record of a log message from the Realm SDK.
MigrationCallback = void Function(Migration migration, int oldSchemaVersion)
The signature of a callback that will be executed when the schema of the Realm changes.
ProgressCallback = void Function(SyncProgress syncProgress) Realm
The signature of a callback that will be executed while the Realm is opened asynchronously with Realm.open. This is the registered onProgressCallback when calling Realm.open that receives progress notifications while the download is in progress.
ShouldCompactCallback = bool Function(int totalSize, int usedSize)
The signature of a callback used to determine if compaction should be attempted.
SyncErrorHandler = void Function(SyncError)
The signature of a callback that will be invoked whenever a SyncError occurs for the synchronized realm.

Exceptions / Errors

AppException
An exception thrown from operations interacting with a Atlas App Services app.
CancelledException
ClientResetError Sync
An error type that describes a client reset error condition.
CompensatingWriteError Sync
An error type that describes a compensating write error, which indicates that one more object changes have been reverted by the server.
InvalidEJson
Thrown when a value cannot be decoded from ejson.
MissingDecoder
Thrown when no decoder is registered for a type.
MissingEncoder
Exception thrown when no encoder is registered for the type of a value.
RealmClosedError Realm
An error throw when operating on an object that has been closed.
RealmError Realm
A base class of all Realm errors.
RealmException Realm
An exception being thrown when a Realm operation or RealmObject access fails.
RealmStateError
Thrown if the Realm operation is not allowed by the current state of the object.
RealmUnsupportedSetError Realm
Thrown if the operation is not supported.
SyncError Sync
Thrown when an error occurs during synchronization This error or its subclasses will be returned to users through FlexibleSyncConfiguration.syncErrorHandler and the exact reason must be found in the message.
UserCallbackException Realm
An exception throws during execution of a user callback - e.g. during migration or initial data population.