update<T> method
Updates objects in the RDB using a single operation.
Implementation
Future<void> update<T>(List<T> objects, { String? subcollection }) async {
Serializer? serializer = RDB.serializers[T];
if (serializer == null) {
throw UnsupportedError('No serializer found for type: $T. Consider re-generating Firestorm data classes.');
}
final Map<String, dynamic> updates = {};
//For each object, serialize it, and then add it to the list of updates:
for (var object in objects) {
var map = serializer(object);
if (map["id"] == null || map["id"].isEmpty) {
throw NullIDException(map);
}
String path = RDB.constructPathForClassAndID(object.runtimeType, map["id"], subcollection: subcollection);
updates[path] = map;
}
await RDB.instance.ref().update(updates);
}