ListSelectControl<K, T>.ofValue constructor

ListSelectControl<K, T>.ofValue({
  1. Key? key,
  2. required KeyedOptionsHandler<K, T> handler,
  3. required TypeaheadHandler<K, T> viewHandler,
  4. required String id,
  5. String? selectedType,
  6. FormValueChanged<List<T?>>? onChange,
  7. bool isRequired = false,
  8. Iterable<T>? initialValue,
  9. String? placeholder,
  10. FocusNode? focusNode,
})

Implementation

ListSelectControl.ofValue({
  Key? key,
  required this.handler,
  required this.viewHandler,
  required this.id,
  this.selectedType,
  FormValueChanged<List<T?>>? onChange,
  this.isRequired = false,
  Iterable<T>? initialValue,
  this.placeholder,
  this.focusNode,
})  : onChange = ((options, source) {
        // Unbox the option as values
        final mapped = options.map((o) => o?.value).notNullList().toList();
        onChange?.call(mapped, source);
      }),
      initialValue = initialValue?.map(handler.toKey).notNull(),
      super(key: key);