changesFor method

Stream<RealmObjectChanges<RealmObjectBase>> changesFor([
  1. List<String>? keyPaths
])

Allows listening for property changes on this Realm object using the specified list of key paths. The key paths indicates which changes in properties should raise a notification.

Returns a Stream of RealmObjectChanges<T> that can be listened to.

If the object is not managed a RealmStateError is thrown.

Example

@RealmModel()
class _Person {
  late String name;
  late int age;
  late List<_Person> friends;
}

// ....

// Only changes to person.age and person.friends will raise a notification
person.changesFor(["age", "friends"]).listen( .... )

Implementation

Stream<RealmObjectChanges<RealmObjectBase>> changesFor([List<String>? keyPaths]) =>
    throw RealmError("Invalid usage. Use the generated inheritors of RealmObject");