distinct method
Returns a new list, which is equal to the original one, but without
duplicates. In other words, the new list has only distinct items.
Optionally, you can provide an id
function to compare the items.
See also: whereNoDuplicates
in FicIterableExtension for a lazy version.
See also: removeDuplicates to mutate the current list.
Implementation
List<T> distinct({dynamic Function(T item)? by}) => by != null
? whereNoDuplicates(by: by).toList()
: [
...{...this}
];