powerset method

Iterable<T> powerset(
  1. T combinator(
    1. T a,
    2. T b
    )
)

Returns the powerset of the Iterable using the provided combinator.

The powerset of a set is the set of all possible subsets of the set.

The combinator is a function that combines two elements of the set.

Example:

print(
  powerset({{1}, {2, 3},}, (a, b) => a + b),
); // prints {3, 4}

Implementation

Iterable<T> powerset(T Function(T a, T b) combinator) {
  return _powerset(
    this,
    combinator,
  );
}