BoundList<S, E> constructor

BoundList<S, E>(
  1. RxList<S> binding,
  2. ChildrenListComposer<S, E> composer
)

Implementation

BoundList(this.binding, this.composer) {
  for (S v in binding) {
    super.add(composer(v));
  }
  binding.onChange.listen((ListChange<S> n) {
    if (n.op == ListOp.add) {
      insert(n.pos!, composer(n.element!));
    } else if (n.op == ListOp.remove) {
      removeAt(n.pos!);
    } else if (n.op == ListOp.clear) {
      clear();
    }
  });
}