initsList<T> function
Returns a List of Lists by adding one element at a time.
Implementation
List<List<T>> initsList<T>(Iterable<T> it) {
if (it.isEmpty) {
return [[]];
}
List<List<T>> result = [[]];
List<T> l = List.from(it);
for (int i = 0; i < l.length; i++) {
result.add(l.sublist(0, i + 1));
}
return result;
}