list<T> method

T list<T>({
  1. required String label,
  2. required List<T> options,
  3. T? initialOption,
  4. String? description,
  5. LabelBuilder<T>? labelBuilder,
})

Allow the users to select from a list of options in a drop down box. Must contain at least one value.

Implementation

T list<T>({
  required String label,
  required List<T> options,
  T? initialOption,
  String? description,
  LabelBuilder<T>? labelBuilder,
}) {
  assert(options.isNotEmpty, 'Must specify at least one option');
  return onKnobAdded(
    ListKnob<T>(
      label: label,
      initialValue: initialOption ?? options.first,
      description: description,
      options: options,
      labelBuilder: labelBuilder,
    ),
  )!;
}