focusNode property

FocusNode? focusNode
final

Optional focus node for the search field.

Providing a FocusNode gives you programmatic control over keyboard focus independently of autofocus:

  • focusNode.requestFocus() — open keyboard at any moment.
  • focusNode.unfocus() — dismiss keyboard without clearing text.
  • focusNode.addListener(...) — react to focus changes in your own code.

Lifecycle: the caller is responsible for disposing the node. The widget will never dispose a caller-provided FocusNode.

If null, an internal node is created and disposed automatically.

Implementation

final FocusNode? focusNode;