distinct method

List<T> distinct({
  1. dynamic by(
    1. T item
    )?,
})

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}
      ];