search method
Future<List<NominatimResponse> >
search({
- required SearchRequest searchRequest,
- String? language,
override
Searches for locations based on the given searchRequest
.
The searchRequest
parameter is required and contains the search criteria.
The optional language
parameter specifies the language for the search results.
Returns a Future that completes with a list of NominatimResponse objects.
Implementation
@override
Future<List<NominatimResponse>> search({
required SearchRequest searchRequest,
String? language,
}) async {
return await loadWithIsolate(() async {
var response = await NominatimServiceClient(
type: NominatimServiceType.search,
searchRequest: searchRequest,
language: language,
).request();
// Convert response to a list of NominatimResponse objects
return (response as List<dynamic>)
.map<NominatimResponse>(
(i) => NominatimResponse.fromJson(i as Map<String, dynamic>))
.toList();
});
}