ListUtils class

Constructors

ListUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

containsDuplicates<T>({required List<T>? items}) bool
Returns true if the given list items contains at least one duplicated value. Otherwise false.
emptyIfNull<T>({required List<T>? items}) List<T>
Returns an empty list if the given parameter items is null. Otherwise the given list is returned.
removeDuplicates<T>({required List<T>? items}) List<T>
Returns a list of unique values from the given parameter items. The order of all unique items are maintained.
removeDuplicatesBy<T>({required List<T>? items, required dynamic by(T a)}) List<T>
Returns a list of unique values identified by the given function parameter by. The order of all unique items are maintained.
sortByNumber<T>({required List<T> items, required num by(T a), bool descending = false}) → void
Sorts the given list by the given parameter by. Default sorting order is ascending. This can be changed by setting the descending to true.
sortByString<T>({required List<T> items, required String by(T a), bool descending = false}) → void
Sorts the given list by the length of the given parameter by. Default sorting order is ascending. This can be changed by setting the descending to true.