MatchedSubstring class

Represents a substring in the prediction that matches the user's input.

Used to highlight matched portions of place names in autocomplete results. The offset indicates where the match starts, and length indicates how many characters match.

Example: For input "San" matching "San Francisco":

  • offset: 0 (match starts at beginning)
  • length: 3 (three characters match)

Constructors

MatchedSubstring({int length = 0, int offset = 0})
Creates a MatchedSubstring instance.
MatchedSubstring.fromJson(Map<String, dynamic> json)
Creates a MatchedSubstring from JSON data.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
Number of characters in the matched substring
getter/setter pair
offset int
Starting position of the match in the string (0-indexed)
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts the MatchedSubstring to JSON format.
toString() String
A string representation of this object.
inherited

Operators

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