removeByType<T extends RealmObject> method

bool removeByType<T extends RealmObject>()

Removes the subscriptions from the set that matches by type, if it exists.

Implementation

bool removeByType<T extends RealmObject>() {
  final name = realm.schema.singleWhere((e) => e.type == T).name;
  var result = false;
  for (var i = length - 1; i >= 0; i--) {
    // reverse iteration to avoid index shifting
    final subscription = this[i];
    if (subscription.objectClassName == name) {
      result |= remove(subscription);
    }
  }
  return result;
}