zip<B> method

Iterable<(T, B)> zip<B>(
  1. Iterable<B> iterable
)

zip is used to join elements at the same index from two different Iterable into one Iterable of a record.

final list1 = ['a', 'b'];
final list2 = [1, 2];
final zipList = list1.zip(list2);
print(zipList); // -> [(a, 1), (b, 2)]

Implementation

Iterable<(T, B)> zip<B>(Iterable<B> iterable) =>
    zipWith((a, b) => (a, b), iterable);