SearchRequest class
A model class representing a search request with various parameters to filter and refine the search results.
This class is used to encapsulate the parameters required for making a search request to find places based on a query and optional structured search parameters.
The SearchRequest class includes options to specify the maximum number of results, preferred language, geographical constraints, and additional details to be included in the response.
Example usage:
SearchRequest request = SearchRequest(
limit: 10,
query: 'coffee shop',
city: 'San Francisco',
state: 'CA',
country: 'USA',
addressDetails: true,
extraTags: true,
nameDetails: true,
);
Properties:
- limit: The maximum number of search results to be returned. This is a required parameter.
- query: The search query used to find places. This is a required parameter.
- street: Optional street name for structured search.
- city: Optional city name for structured search.
- county: Optional county name for structured search.
- state: Optional state name for structured search.
- country: Optional country name for structured search.
- postalCode: Optional postal code for structured search.
- language: Optional preferred language for showing search results.
- countryCodes: Optional list of country codes to limit search results.
- excludePlaceIds: Optional list of place IDs to exclude from search results.
- viewBox: Optional view box to search within a geographical area.
- addressDetails: Specifies whether to include detailed address information in the response. Defaults to
false
. - extraTags: Specifies whether to include extra tags like Wikipedia link, opening hours, etc. Defaults to
false
. - nameDetails: Specifies whether to include a list of alternative names in the results. Defaults to
false
.
Constructor:
- SearchRequest: Creates a new instance of the SearchRequest class with the specified parameters.
Constructors
-
SearchRequest({required int limit, required String query, String? street, String? city, String? county, String? state, String? country, String? postalCode, String? language, List<
String> ? countryCodes, List<String> ? excludePlaceIds, ViewBox? viewBox, bool? addressDetails = true, bool? extraTags = true, bool? nameDetails = true})
Properties
- addressDetails ↔ bool?
-
Specifies whether to include detailed address information in the response.
getter/setter pair
- city → String?
-
Optional: City name for structured search.
final
- country → String?
-
Optional: Country name for structured search.
final
-
countryCodes
→ List<
String> ? -
Optional: Limit search results to specific country codes.
final
- county → String?
-
Optional: County name for structured search.
final
-
excludePlaceIds
→ List<
String> ? -
Optional: Skip certain place IDs from appearing in search results.
final
- extraTags ↔ bool?
-
Specifies whether to include extra tags like Wikipedia link, opening hours, etc.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- language → String?
-
Optional: Preferred language for showing search results.
final
- limit → int
-
The maximum number of search results to be returned.
final
- nameDetails ↔ bool?
-
Specifies whether to include a list of alternative names in the results.
getter/setter pair
- postalCode → String?
-
Optional: Postal code for structured search.
final
- query → String
-
The search query used to find places.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → String?
-
Optional: State name for structured search.
final
- street → String?
-
Optional: Street name for structured search.
final
- viewBox → ViewBox?
-
Optional: Specify a view box for searching within a geographical area.
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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited