watchUnsub method

Future<HGrid> watchUnsub(
  1. HClientWatch w,
  2. List<HRef> ids
)

Implementation

Future<HGrid> watchUnsub(HClientWatch w, List<HRef> ids) {
  if (ids.isEmpty) throw ArgumentError("ids are empty");
  if (w.id == null) throw StateError("nothing subscribed yet");
  if (w.isClosed) throw StateError("watch is closed");

  // grid meta
  var b = HGridBuilder();
  b.meta.add("watchId", w.id);

  // grid rows
  b.addCol("id");

  for (int i = 0; i < ids.length; ++i) {
    b.addRow([ids[i]]);
  }

  // make request
  return call("watchUnsub", b.toGrid());
}