toUniqueList method

UniqueList<E> toUniqueList({
  1. bool growable = true,
  2. bool nullable = true,
  3. bool strict = false,
})

Creates an UniqueList containing the elements of this iterable.

The elements are in iteration order.

The list is fixed-length if growable is false.

If strict is true, every value in this iterable must be unique, otherwise a DuplicateValuesError will be thrown. If false, duplicate values will be removed from the list, with only the first occurence of the value remaining.

Implementation

UniqueList<E> toUniqueList({
  bool growable = true,
  bool nullable = true,
  bool strict = false,
}) {
  final list = UniqueList._constructListFrom<E>(this,
      nullable: nullable, strict: strict, growable: growable);
  return UniqueList._(List<E>.from(list, growable: growable),
      nullable: nullable, strict: strict, growable: growable);
}