mapToList<R> method
Maps this iterable to a List using mapperFunction.
Returns an empty list if this iterable is null or empty.
Example:
List<int>? numbers = [1, 2, 3];
List<String> strings = numbers.mapToList((n) => n.toString()); // ['1', '2', '3']
Implementation
List<R> mapToList<R>(R Function(E item) mapperFunction) {
return isNullOrEmpty ? [] : this!.map((e) => mapperFunction(e)).toList();
}