ListUtils<T> extension
A collection of useful List extensions to simplify common operations.
- on
-
- List<
T>
- List<
Methods
-
chunked(
{required int size}) → List< List< T> > -
Available on List<
Splits the list into chunks of sizeT> , provided by the ListUtils extensionsize. -
elementAtOrNull(
{required int index}) → T? -
Available on List<
Safely returns the element atT> , provided by the ListUtils extensionindex, ornullif out of range. -
groupBy<
K> (K keySelector(T)) → Map< K, List< T> > -
Available on List<
Groups list items by a key returned fromT> , provided by the ListUtils extensionkeySelector. -
mapNotNull<
R> (R? transform(T)) → List< R> -
Available on List<
Maps each element usingT> , provided by the ListUtils extensiontransformand removesnullresults. -
sortIt<
R extends Comparable> ([R selector(T)?]) → List< T> -
Available on List<
Returns a new list sorted by the value produced byT> , provided by the ListUtils extensionselector. -
sortItDesc<
R extends Comparable> ([R selector(T)?]) → List< T> -
Available on List<
Returns a new list sorted in descending order based onT> , provided by the ListUtils extensionselector. -
sortItSelf<
R extends Comparable> ([R selector(T)?]) → void -
Available on List<
Sorts this list in-place using the value returned byT> , provided by the ListUtils extensionselector. -
sortItSelfDesc<
R extends Comparable> ([R selector(T)?]) → void - Sorts this list in-place in descending order.