getCollection<T extends ResModel> method
Subscribe to a collection. The collection will automatically listen for changes to the collection (add and remove). Additionally, the collection will listen for changes to each model in the collection.
Implementation
Future<ResCollection<T>> getCollection<T extends ResModel>(
String rid,
T Function() modelFactory,
) async {
var id = await send("subscribe", rid, null);
var json = await receive(id);
var collection = ResCollection(
client: this,
rid: rid,
modelFactory: modelFactory,
);
collection.addModelsFromJson(json["result"] as Map<String, dynamic>);
collection.listen();
return collection;
}