deleteMany<T extends RealmObject> method

void deleteMany<T extends RealmObject>(
  1. Iterable<T> items
)

Deletes many RealmObjects from this Realm.

Efficiently deletes all objects from the Realm and clears the items collection of type RealmResults, RealmList or RealmSet. Throws RealmException if there is no active write transaction.

Implementation

void deleteMany<T extends RealmObject>(Iterable<T> items) {
  if (items is RealmResults<T>) {
    _ensureManagedByThis(items, 'delete objects from Realm');

    realmCore.resultsDeleteAll(items);
  } else if (items is ManagedRealmList<T>) {
    _ensureManagedByThis(items, 'delete objects from Realm');

    realmCore.listDeleteAll(items);
  } else if (items is ManagedRealmSet<T>) {
    _ensureManagedByThis(items, 'delete objects from Realm');

    realmCore.realmSetRemoveAll(items);
  } else {
    for (T realmObject in items) {
      delete(realmObject);
    }
  }
}