Matcher<T> constructor

Matcher<T>({
  1. required String trigger,
  2. required List<T> suggestions,
  3. required String idProp(
    1. dynamic suggestion
    ),
  4. required String displayProp(
    1. dynamic suggestion
    ),
  5. MatcherSearchStyle searchStyle = MatcherSearchStyle.iContains,
  6. int resultSort(
    1. String text,
    2. dynamic a,
    3. dynamic b
    )?,
  7. int finalResultSort(
    1. String text,
    2. dynamic a,
    3. dynamic b
    )?,
  8. required String stringify(
    1. String trigger,
    2. dynamic suggestion
    ),
  9. required T parse(
    1. RegExp regex,
    2. String stringifiedSuggestion
    ),
  10. required RegExp parseRegExp,
  11. dynamic onSuggestionAdded(
    1. String trigger,
    2. dynamic suggestion
    )?,
  12. TextStyle? style,
  13. Widget suggestionBuilder(
    1. Matcher matcher,
    2. dynamic suggestion
    )?,
  14. bool alwaysHighlight = false,
})

This is the core of what makes flutter_parsed_text_field work. This is where you define what triggers suggestions, what those suggestions are, and how they are used.

Implementation

Matcher({
  required this.trigger,
  required this.suggestions,
  required this.idProp,
  required this.displayProp,
  this.searchStyle = MatcherSearchStyle.iContains,
  this.resultSort,
  this.finalResultSort,
  required this.stringify,
  required this.parse,
  required this.parseRegExp,
  this.onSuggestionAdded,
  this.style,
  this.suggestionBuilder,
  this.alwaysHighlight = false,
}) : assert(trigger.length == 1);