Matcher<T> class

Constructors

Matcher({required String trigger, required List<T> suggestions, required String idProp(dynamic suggestion), required String displayProp(dynamic suggestion), MatcherSearchStyle searchStyle = MatcherSearchStyle.iContains, int resultSort(String text, dynamic a, dynamic b)?, int finalResultSort(String text, dynamic a, dynamic b)?, required String stringify(String trigger, dynamic suggestion), required T parse(RegExp regex, String stringifiedSuggestion), required RegExp parseRegExp, dynamic onSuggestionAdded(String trigger, dynamic suggestion)?, TextStyle? style, Widget suggestionBuilder(Matcher matcher, dynamic suggestion)?, 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.

Properties

alwaysHighlight bool
True if the style should always be applied regardless if it matches a suggestion; false otherwise.
final
displayProp String Function(dynamic suggestion)
A function to return the display of the suggestion.
final
finalResultSort → (int Function(String text, dynamic a, dynamic b)?)
A function to return the prop for sorting the final results AFTER FlutterParsedTextField.suggestionLimit is applied
final
hashCode int
The hash code for this object.
no setterinherited
idProp String Function(dynamic suggestion)
A function to return the id of the suggestion.
final
indexOfMatch int?
Starting index in the text field of the current match
getter/setter pair
lengthOfMatch int?
The length of the partial match (including trigger)
getter/setter pair
onSuggestionAdded → (dynamic Function(String trigger, dynamic suggestion)?)
When a suggestion has been tapped and added to the text field, it will be returned. This allows you to, say, update the #hashtag list when an @mention has been added.
final
parse → T Function(RegExp regex, String stringifiedSuggestion)
A function to parse the stringified suggestion back into an object.
final
parseRegExp RegExp
The RegExp that will match stringified suggestions and enable parsing
final
regexPattern String
no setter
resultSort → (int Function(String text, dynamic a, dynamic b)?)
A function to return the prop for sorting the final results BEFORE FlutterParsedTextField.suggestionLimit is applied
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchStyle MatcherSearchStyle
How the search logic should be applied
final
stringify String Function(String trigger, dynamic suggestion)
A function which will stringify the suggestion
final
style TextStyle?
The TextStyle to be applied to matches within the text field
final
suggestionBuilder → (Widget Function(Matcher matcher, dynamic suggestion)?)
Returns a widget that will be used in the suggestion popup's ListView
final
suggestions List<T>
A list of objects that should be used to populate the suggestions popup
final
trigger String
The single character that will cause the suggestions to start appearing
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
typeOf() Type

Operators

operator ==(Object other) bool
The equality operator.
inherited