combinations<T> method
Implementation
Iterable<List<T>> combinations<T>(List<T> set) {
final result = <List<T>>[[]];
for (final element in set) {
final newCombinations = <List<T>>[];
for (final combination in result) {
final ret = [element, ...combination];
newCombinations.add(ret);
}
result.addAll(newCombinations);
}
return result;
}