$new static method

$Value? $new(
  1. Runtime runtime,
  2. $Value? thisValue,
  3. List<$Value?> args
)

Wrapper for the RawAutocomplete.new constructor

Implementation

static $Value? $new(Runtime runtime, $Value? thisValue, List<$Value?> args) {
  return $RawAutocomplete.wrap(
    RawAutocomplete(
      key: args[0]?.$value,
      optionsViewBuilder: (
        BuildContext context,
        void Function(Object option) onSelected,
        Iterable<Object> options,
      ) {
        return (args[1]! as EvalCallable)(runtime, null, [
          runtime.wrapAlways(context),
          $Function((runtime, target, args) {
            onSelected(args[0]!.$value);
            return const $null();
          }),
          $Iterable.wrap(options),
        ])?.$value;
      },
      optionsBuilder: (TextEditingValue textEditingValue) {
        return (args[2]! as EvalCallable)(runtime, null, [
          $TextEditingValue.wrap(textEditingValue),
        ])?.$value;
      },
      optionsViewOpenDirection:
          args[3]?.$value ?? OptionsViewOpenDirection.down,
      displayStringForOption: (dynamic option) {
        return (args[4]! as EvalCallable?)?.call(runtime, null, [
          $Object(option),
        ])?.$value;
      },
      fieldViewBuilder: (
        BuildContext context,
        TextEditingController textEditingController,
        FocusNode focusNode,
        void Function() onFieldSubmitted,
      ) {
        return (args[5]! as EvalCallable?)?.call(runtime, null, [
          runtime.wrapAlways(context),
          runtime.wrapAlways(textEditingController),
          runtime.wrapAlways(focusNode),
          $Function((runtime, target, args) {
            onFieldSubmitted();
            return const $null();
          }),
        ])?.$value;
      },
      focusNode: args[6]?.$value,
      onSelected: (dynamic option) {
        (args[7]! as EvalCallable?)?.call(runtime, null, [$Object(option)]);
      },
      textEditingController: args[8]?.$value,
      initialValue: args[9]?.$value,
    ),
  );
}