Skip to content

0.5.0+beta

Compare
Choose a tag to compare
@realm-ci realm-ci released this 10 Oct 12:25
502ee10

0.5.0+beta (2022-10-10)

This project is in the Beta stage. The API should be quite stable, but occasional breaking changes may be made.

Breaking Changes

  • Fixed an issue that would cause passwords sent to the server (e.g. Credentials.EmailPassword or EmailPasswordAuthProvider.registerUser) to contain an extra empty byte at the end. (PR #918).
    Notice: Any existing email users might need to be recreated because of this breaking change.

Enhancements

  • Added support for "frozen objects" - these are objects, queries, lists, or Realms that have been "frozen" at a specific version. All frozen objects can be accessed and queried as normal, but attempting to mutate them or add change listeners will throw an exception. Realm, RealmObject, RealmList, and RealmResults now have a method freeze() which returns an immutable version of the object, as well as an isFrozen property which can be used to check whether an object is frozen. (#56)
  • You can now set a realm property of type T to any object o where o is T. Previously it was required that o.runtimeType == T. (#904)
  • Performance of indexOf on realm lists has been improved. It now uses realm-core instead of the generic version from ListMixin. (#911)
  • Performance of remove on realm list has been improved. It now uses indexOf and removeAt. (#915)
  • Added support for migrations for local Realms. You can now construct a configuration with a migration callback that will be invoked if the schema version of the file on disk is lower than the schema version supplied by the callback. (#70)
    Example:
    final config = Configuration.local([Person.schema], schemaVersion: 4, migrationCallback: (migration, oldSchemaVersion) {
      if (oldSchemaVersion == 1) {
        // Between v1 and v2 we removed the Bar type
        migration.deleteType('Bar');
      }
    
      if (oldSchemaVersion == 2) {
        // Between v2 and v3 we fixed a typo in the 'Person.name' property.
        migration.renameProperty('Person', 'nmae', 'name');
      }
    
      if (oldSchemaVersion == 3) {
        final oldPeople = migration.oldRealm.dynamic.all('Person');
        for (final oldPerson in oldPeople) {
          final newPerson = migration.findInNewRealm<Person>(oldPerson);
          if (newPerson == null) {
            // That person must have been deleted, so nothing to do.
            continue;
          }
    
          // Between v3 and v4 we're obfuscating the users' exact age by storing age group instead.
          newPerson.ageGroup = calculateAgeGroup(oldPerson.dynamic.get<int>('age'));
        }
      }
    });
  • Added support for realm list of nullable primitive types, ie. RealmList<int?>. (#163)
  • Allow null arguments on query. (#871)
  • Added support for API key authentication. (Issue #432)
    • Expose User.apiKeys client - this client can be used to create, fetch, and delete API keys.
    • Expose Credentials.apiKey that enable authentication with API keys.
  • Exposed User.accessToken and User.refreshToken - these tokens can be used to authenticate against the server when calling HTTP API outside of the Dart/Flutter SDK. For example, if you want to use the GraphQL. (PR #919)
  • Added support for encryptionKey to Configuration.local, Configuration.flexibleSync and Configuration.disconnectedSync so realm files can be encrypted and existing encrypted files from other Realm sources opened (assuming you have the key)(#920)

Fixed

  • Previously removeAt did not truncate length. (#883)
  • List.length= now throws, if you try to increase length. This previously succeeded silently. (#894).
  • Queries on lists were broken. (#909)
    Example:
    expect(realm.all<Person>(), [alice, bob, carol, dan]); // assume this pass, then ...
    expect(team.players.query('TRUEPREDICATE'), [alice, bob]); // <-- ... this fails and return the same as realm.all<Person>()
  • Queries on results didn't filter the existing results. (#908).
    Example
    expect(realm.query<Person>('FALSEPREDICATE').query('TRUEPREDICATE'), isEmpty); //<-- Fails if a Persion object exists
  • Fixed copying of native structs for session errors and http requests. (#924)
  • Fixed a crash when closing the SyncSession on App instance teardown. (#5752)
  • Fixed sporadic generator failure. (#879)
  • Exceptions thrown by user code inside the Configuration.initialDataCallback are now properly surfaced back to the Realm() constructor. (#698)

Compatibility

  • Realm Studio: 12.0.0 or later.

Internal

  • Uses Realm Core v12.9.0
  • Added tracking of child handles for objects/results/lists obtained from an unowned Realm. This ensures that all children are invalidated as soon as the parent Realm gets released at the end of the callback. (Issue #527)
  • Added an action to enforce that the changelog is updated before a PR is merged (Issue #939)