removeDuplicates<T> static method
Returns a list of unique values from the given parameter items
.
The order of all unique items are maintained.
If the given parameter is null an empty list will be returned.
Implementation
static List<T> removeDuplicates<T>({required List<T>? items}) {
if (items == null) {
return [];
}
List<T> uniqueValues = List.empty(growable: true);
for (var item in items) {
if (!uniqueValues.contains(item)) {
uniqueValues.add(item);
}
}
return uniqueValues;
}