to<R> method
List<R>
to<
R>( - R combine(
- int index,
- E element
), {
- bool reverse = false,
- int limit = 0,
})
Implementation
List<R> to<R>(
R Function(int index, E element) combine, {
bool reverse = false,
int limit = 0,
}) {
List<R> initial = [];
if (isEmpty) return initial;
int index = reverse ? length - 1 : 0;
while (index >= 0 && index < length && elementAtOrNull(index) != null) {
if (initial.length >= limit) break;
initial.add(combine(index, elementAt(index)));
index = reverse ? index - 1 : index + 1;
}
return initial;
}