Select<T> constructor

const Select<T>({
  1. Key? id,
  2. required List<T> items,
  3. required SelectState<T> state,
  4. required SelectItemBuilder<T> builder,
  5. SelectionMode mode = SelectionMode.single,
  6. int visibleCount = 5,
  7. String placeholder = 'No items',
  8. T? defaultValue,
  9. List<T> defaultValues = const [],
  10. bool filterable = false,
  11. SelectFilter<T>? filter,
  12. String filterPlaceholder = 'Filter...',
  13. int? minSelections,
  14. int? maxSelections,
  15. String? validate(
    1. List<T> selected
    )?,
  16. void onChanged(
    1. T item
    )?,
  17. void onSubmit(
    1. List<T> items
    )?,
  18. void onToggle(
    1. T item,
    2. bool selected
    )?,
})

Implementation

const Select({
  Key? id,
  required this.items,
  required this.state,
  required this.builder,
  this.mode = SelectionMode.single,
  this.visibleCount = 5,
  this.placeholder = 'No items',
  this.defaultValue,
  this.defaultValues = const [],
  this.filterable = false,
  this.filter,
  this.filterPlaceholder = 'Filter...',
  this.minSelections,
  this.maxSelections,
  this.validate,
  this.onChanged,
  this.onSubmit,
  this.onToggle,
})  : _id = id,
      assert(visibleCount > 0),
      assert(minSelections == null || minSelections >= 0),
      assert(maxSelections == null || maxSelections >= 1),
      assert(minSelections == null ||
          maxSelections == null ||
          minSelections <= maxSelections);