ItemBuilder<T> typedef

ItemBuilder<T> = Widget Function(BuildContext context, T item, int index, {List<String> searchTerms})

Builder function for list items.

The searchTerms parameter contains the individual words from the current search query, split by whitespace. For example, the query "red apple" produces ['red', 'apple']. Pass these to SearchHighlightText or use them in your own highlighting logic.

When searchTerms is empty: The list is always [] (never null) when the search query is empty or contains only whitespace. This applies to both offline and async modes.

When searchTerms is populated: Contains one or more non-empty strings whenever the user has typed a search query. In async mode, the terms reflect the query string even though matching was handled by the async loader, so you can still use them for client-side highlighting.

Implementation

typedef ItemBuilder<T> =
    Widget Function(
      BuildContext context,
      T item,
      int index, {
      List<String> searchTerms,
    });