list<T> function

Arbitrary<List<T>> list<T>(
  1. Arbitrary<T> element, {
  2. int? minLength,
  3. int? maxLength,
  4. bool? unique,
  5. bool uniqueBy(
    1. T,
    2. T
    )?,
})

Returns an arbitrary that generates a list value.

To disallow duplicates, specify unique or uniqueBy. unique uses the == operator to determine if elements are equal. To use any other method of comparison, specify uniqueBy.

Parameters:

  • element: The arbitrary to use to generate the elements of the list.
  • minLength: The minimum length of the list.
  • maxLength: The maximum length of the list.
  • unique: Whether the list should contain unique elements.
  • uniqueBy: A function to determine uniqueness of elements.

Implementation

Arbitrary<List<T>> list<T>(
  Arbitrary<T> element, {
  int? minLength,
  int? maxLength,
  bool? unique,
  bool Function(T, T)? uniqueBy,
}) =>
    ListArbitraries.list(
      element,
      minLength: minLength,
      maxLength: maxLength,
      unique: unique,
      uniqueBy: uniqueBy,
    );