bindOneByIndexStream method

void bindOneByIndexStream(
  1. Iterable<E> options,
  2. Stream<int> other, [
  3. int? initial
])

Implementation

void bindOneByIndexStream(Iterable<E> options, Stream<int> other,
    [int? initial]) {
  {
    int? value = initial;
    for (int i = 0; i < options.length; i++) {
      if (value == i)
        add(options.elementAt(i));
      else
        remove(options.elementAt(i));
    }
  }
  other.listen((int value) {
    for (int i = 0; i < options.length; i++) {
      if (value == i)
        add(options.elementAt(i));
      else
        remove(options.elementAt(i));
    }
  });
}