pairs<K, V> method

Iterable<Pair<K, V>> pairs<K, V>()

Creates an Iterable of Pairs from an Iterable of lists. Each list should contain 2 values.

Implementation

Iterable<Pair<K, V>> pairs<K, V>() sync* {
  for (final iterable in this) {
    if (iterable.length == 2) {
      yield Pair<K, V>(iterable.elementAt(0), iterable.elementAt(1));

    } else {
      throw ArgumentError.value('Pair has a length of: ${iterable.length}, should be 2');
    }
  }
}