product method
Combines a tuple of iterables with the cross product to an iterable of tuples.
For example, the product of ['x', 'y']
and [1, 2, 3]
is created with
(['x', 'y'], [1, 2, 3]).product();
and results in an iterable with the following tuples:
('x', 1)
('x', 2)
('x', 3)
('y', 1)
('y', 2)
('y', 3)
Implementation
Iterable<(T1, T2)> product() sync* {
for (final v1 in $1) {
for (final v2 in $2) {
yield (v1, v2);
}
}
}