selectFocusedOption method

void selectFocusedOption()

Select the currently focused option.

Implementation

void selectFocusedOption() {
  final focused = focusedValue.value;
  if (focused == null) return;

  // Check if the option is disabled
  final optIndex = options.indexWhere((o) => o.value == focused);
  if (optIndex >= 0 && options[optIndex].disabled) return;

  selectedValue.value = focused;
  onChange?.call(focused);
}