onSuggestionSelected property Null safety

SuggestionSelectionCallback<T>? onSuggestionSelected

Called when a suggestion is tapped.

This callback must not be null. It is called by the TypeAhead widget and provided with the value of the tapped suggestion.

For example, you might want to navigate to a specific view when the user tabs a suggestion:

onSuggestionSelected: (suggestion) {
    builder: (context) => SearchResult(
      searchItem: suggestion

Or to set the value of the text field:

onSuggestionSelected: (suggestion) {
  _controller.text = suggestion['name'];


final SuggestionSelectionCallback<T>? onSuggestionSelected;