open static method
A method for asynchronously opening a Realm.
config
- a configuration object that describes the realm.cancellationToken
- an optional CancellationToken used to cancel the operation.
Returns Future<Realm>
that completes with the Realm once the remote Realm is fully synchronized or with a CancelledException if operation is canceled.
When the configuration is LocalConfiguration this completes right after the local Realm is opened.
Using Realm.open for opening a local Realm is equivalent to using the constructor of Realm.
Implementation
static Future<Realm> open(Configuration config, {CancellationToken? cancellationToken}) async {
if (cancellationToken != null && cancellationToken.isCancelled) {
throw cancellationToken.exception!;
}
final realm = Realm(config);
return await CancellableFuture.value(realm, cancellationToken);
}