freeze method
Returns a frozen (immutable) snapshot of this Realm.
A frozen Realm is an immutable snapshot view of a particular version of a Realm's data. Unlike normal Realm instances, it does not live-update to reflect writes made to the Realm. Writing to a frozen Realm is not allowed, and attempting to begin a write transaction will throw an exception.
All objects and collections read from a frozen Realm will also be frozen.
Note: Keeping a large number of frozen Realms with different versions alive can have a negative impact on the file size of the underlying database.
Implementation
Realm freeze() {
if (isFrozen) {
return this;
}
return Realm._(config, realmCore.freeze(this));
}