searchFunction static method

bool searchFunction({
  1. required dynamic searchTerms,
  2. required Iterable searchOnItems,
  3. int levenshteinDistance = 0,
  4. bool ignoreCase = true,
  5. bool ignoreDiacritics = true,
  6. bool ignoreWordSplitters = true,
  7. bool splitCamelCase = true,
  8. bool useWildcards = false,
})

Searches for a specific item in an iterable based on given search terms and criteria.

The searchFunction function takes in the following parameters:

  • searchTerms: The search terms to match against.
  • searchOn: An iterable of values to search on for each item.
  • levenshteinDistance: The maximum allowed Levenshtein distance for fuzzy matching. Defaults to 0.
  • ignoreCase: Whether to ignore case sensitivity when matching. Defaults to true.
  • ignoreDiacritics: Whether to ignore diacritics (accented characters) when matching. Defaults to true.
  • ignoreWordSplitters: Whether to ignore word splitters (e.g. spaces, hyphens) when matching. Defaults to true.
  • splitCamelCase: Whether to split camel case words when matching. Defaults to true.
  • useWildcards: Whether to use wildcards (*) for partial matching. Defaults to false.

Returns true if the item matches any of the search terms based on the given criteria, false otherwise.

Implementation

static bool searchFunction({
  required dynamic searchTerms,
  required Iterable searchOnItems,
  int levenshteinDistance = 0,
  bool ignoreCase = true,
  bool ignoreDiacritics = true,
  bool ignoreWordSplitters = true,
  bool splitCamelCase = true,
  bool useWildcards = false,
}) =>
    countSearch(
      searchTerms: searchTerms,
      searchOnItems: searchOnItems,
      ignoreCase: ignoreCase,
      ignoreDiacritics: ignoreDiacritics,
      ignoreWordSplitters: ignoreWordSplitters,
      splitCamelCase: splitCamelCase,
      useWildcards: useWildcards,
    ) >
    0;