deleteMany<T extends RealmObject> method
Deletes many RealmObject
s 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');
items.handle.deleteAll();
} else if (items is ManagedRealmList<T>) {
_ensureManagedByThis(items, 'delete objects from Realm');
items.handle.deleteAll();
} else if (items is ManagedRealmSet<T>) {
_ensureManagedByThis(items, 'delete objects from Realm');
items.handle.deleteAll();
} else {
for (T realmObject in items) {
delete(realmObject);
}
}
}