FixedListInputConfig constructor

FixedListInputConfig({
  1. required String id,
  2. required String label,
  3. String? defaultValue,
  4. bool? required,
  5. Conditions? conditions,
  6. required List<String> options,
  7. String? defaultOption,
})

Implementation

FixedListInputConfig({
  required super.id,
  required super.label,
  super.defaultValue,
  super.required,
  super.conditions,
  required this.options,
  this.defaultOption,
}) : super(type: InputType.fixedList) {
  bool defaultExists = defaultOption == null;
  maxLength = options.fold<int>(
    0,
    (max, o) {
      defaultExists = defaultExists || o == defaultOption;
      return o.length > max ? o.length : max;
    },
  );
  assert(defaultExists, 'defaultOption not in options');
}