getCollection<T extends ResModel> method
One-off get on a collection, returning its models.
Unlike subscribeToCollection, this does not subscribe or track state; models receive no change events.
Implementation
Future<Iterable<T>> getCollection<T extends ResModel>(
String rid,
T Function() modelFactory,
) async {
var id = await send("get", rid, null);
var json = await receive(id);
var result = json["result"] as Map<String, dynamic>;
return [
for (var item in result["collections"][rid] as Iterable)
modelFactory()
..updateFromJson(
result["models"][item["rid"]] as Map<String, dynamic>,
),
];
}