ofProperty static method

OptionsHandler<String> ofProperty(
  1. IMSchemaProperty prop, {
  2. String placeholder = "Enter an option",
  3. List<String>? allOptions,
  4. required bool allowAdHoc,
})

Implementation

static OptionsHandler<String> ofProperty(
  IMSchemaProperty prop, {
  String placeholder = "Enter an option",
  List<String>? allOptions,
  required bool allowAdHoc,
}) {
  if (prop is IStringSelectProperty) {
    allOptions ??= prop.options;
  }
  allOptions ??= [];
  return _OptionsHandler<String>(prop.baseCode,
      allOptions: allOptions,
      placeholder: placeholder,
      canShowAll: true,
      adhocOptionsBuilder: allowAdHoc == true
          ? ((item, {context}) => AdhocOption.ofString("$item"))
          : null,
      toOption: ((String? from) => Option.ofValue(from)));
}