UniqueList<E>.of constructor

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

Creates a list from elements.

The Iterator of elements provides the order of the elements.

This constructor creates a growable list when growable is true; otherwise, it returns a fixed-length list.

If strict is true, a DuplicateValuesError will be thrown when a value is added to the list that already exists in the list.

If nullable is true, the list may contain multiple instances of null, otherwise, null will be treated like any other value and only one instance of null may be contained in the list.

Implementation

factory UniqueList.of(
  Iterable<E> elements, {
  bool growable = true,
  bool strict = false,
  bool nullable = true,
}) {
  final list =
      _constructListFrom<E>(elements, nullable: nullable, strict: strict, growable: growable);
  return UniqueList<E>._(List<E>.of(list, growable: growable),
      nullable: nullable, strict: strict, growable: growable);
}