StructuredFormatting class
Structured breakdown of a place prediction into main and secondary text.
Provides a formatted representation of the place name, typically with:
- Main text: Primary place name (e.g., "Central Park")
- Secondary text: Additional context (e.g., "New York, NY, USA")
Also includes information about which parts of each text match the user's input.
Example:
final formatting = prediction.structuredFormatting;
print('${formatting.mainText}, ${formatting.secondaryText}');
// Output: "Pizza Hut, 123 Main St, City"
Constructors
-
StructuredFormatting({String mainText = "", List<
MatchedSubstring> ? mainTextMatchedSubstrings, String secondaryText = "", List<MatchedSubstring> ? secondaryTextMatchedSubstrings}) - Creates a StructuredFormatting instance.
-
StructuredFormatting.fromJson(Map<
String, dynamic> json) -
Creates a StructuredFormatting from JSON data.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- mainText ↔ String
-
Primary place name or address component
getter/setter pair
-
mainTextMatchedSubstrings
↔ List<
MatchedSubstring> ? -
Substrings in mainText that match user input
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secondaryText ↔ String
-
Secondary descriptive text (location, address details)
getter/setter pair
-
secondaryTextMatchedSubstrings
↔ List<
MatchedSubstring> ? -
Substrings in secondaryText that match user input
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts the StructuredFormatting to JSON format.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited