anchor.diff:        clearSearchField: clearSearchField,
         keyEventsToPropagate: keyEventsToPropagate,
         supportClearField: supportClearField,
  -      closeHandler: _closeHandler,
       );
     }
   
  
positive.code:         : KeyEventResult.handled;
    }
  
    void _highlightDropdown(
      AutoCompleteSearchControllerMixin controller,
      bool directionDown,
    ) {
  
negative.code:   final ClearSearchField clearSearchField;
    final Set<LogicalKeyboardKey> keyEventsToPropagate;
    final bool supportClearField;
  
    @override
    State<_AutoCompleteSearchField> createState() =>
        _AutoCompleteSearchFieldState();
  }
  
  class _AutoCompleteSearchFieldState extends State<_AutoCompleteSearchField>
      with AutoDisposeMixin {
    /// Platform independent (Mac or Linux).
    int get arrowDown =>
        LogicalKeyboardKey.arrowDown.keyId & LogicalKeyboardKey.valueMask;
  
    int get arrowUp =>
        LogicalKeyboardKey.arrowUp.keyId & LogicalKeyboardKey.valueMask;
  
    int get enter =>
        LogicalKeyboardKey.enter.keyId & LogicalKeyboardKey.valueMask;
  
    int get escape =>
        LogicalKeyboardKey.escape.keyId & LogicalKeyboardKey.valueMask;
  
    int get tab => LogicalKeyboardKey.tab.keyId & LogicalKeyboardKey.valueMask;
  
    HighlightAutoComplete get _highlightDropdown =>
        widget.onHighlightDropdown != null
            ? widget.onHighlightDropdown
            : _highlightDropdownDefault;
  
    @override
    void initState() {
      super.initState();
  
      addAutoDisposeListener(
          widget.searchFieldFocusNode, _closeAutoCompleteOnFocusLost);
      widget.rawKeyboardFocusNode.onKey = _handleKeyStrokes;
    }
  
    @override
    Widget build(BuildContext context) {
      return RawKeyboardListener(
        focusNode: widget.rawKeyboardFocusNode,
        child: CompositedTransformTarget(
          link: widget.autoCompleteLayerLink,
          child: widget.searchField,
        ),
      );
    }
  
    void _closeAutoCompleteOnFocusLost() {
      if (!widget.searchFieldFocusNode.hasFocus) {
        widget.controller.closeAutoCompleteOverlay();
      }
    }
  
    KeyEventResult _handleKeyStrokes(FocusNode node, RawKeyEvent event) {
      if (event is RawKeyDownEvent) {
        final key = event.data.logicalKey.keyId & LogicalKeyboardKey.valueMask;
  
        if (key == escape) {
          // TODO(kenz): Enable this once we find a way around the navigation
          // this causes. This triggers a "back" navigation.
          // ESCAPE key pressed clear search TextField.c
          if (widget.controller.autoCompleteOverlay != null) {
            widget.controller.closeAutoCompleteOverlay();
          } else if (widget.supportClearField) {
            // If pop-up closed ESCAPE will clean the TextField.
            widget.clearSearchField(widget.controller, force: true);
          }
          return _determineKeyEventResult(
            key,
            widget.keyEventsToPropagate,
          );
        } else if (widget.controller.autoCompleteOverlay != null) {
          if (key == enter || key == tab) {
            // Enter / Tab pressed.
            String foundExact;
  
            // What the user has typed in so far.
            final searchToMatch = widget.controller.search.toLowerCase();
            // Find exact match in autocomplete list - use that as our search value.
            for (final autoEntry in widget.controller.searchAutoComplete.value) {
              if (searchToMatch == autoEntry.text.toLowerCase()) {
                foundExact = autoEntry.text;
                break;
              }
            }
            // Nothing found, pick item selected in dropdown.
            final autoCompleteList = widget.controller.searchAutoComplete.value;
            if (foundExact == null ||
                autoCompleteList[widget.controller.currentDefaultIndex].text !=
                    foundExact) {
              if (autoCompleteList.isNotEmpty) {
                foundExact =
                    autoCompleteList[widget.controller.currentDefaultIndex].text;
              }
            }
  
            if (foundExact != null) {
              widget.controller.selectTheSearch = true;
              widget.controller.search = foundExact;
              widget.onSelection(foundExact);
              return _determineKeyEventResult(key, widget.keyEventsToPropagate);
            }
          } else if (key == arrowDown || key == arrowUp) {
            _highlightDropdown(widget.controller, key == arrowDown);
            return _determineKeyEventResult(key, widget.keyEventsToPropagate);
          }
        }
  
        // We don't support tabs in the search input. Swallow to prevent a
        // change of focus.
        if (key == tab) {
          _determineKeyEventResult(key, widget.keyEventsToPropagate);
        }
      }
  
      return KeyEventResult.ignored;
    }
  
    KeyEventResult _determineKeyEventResult(
  