lookup method

  1. @override
Future<List<NominatimResponse>> lookup({
  1. required LookupRequest lookupRequest,
  2. String? language,
})
override

Performs a lookup request to the Nominatim service.

The lookupRequest parameter is required and contains the details of the lookup request. 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>> lookup({
  required LookupRequest lookupRequest,
  String? language,
}) async {
  return await loadWithIsolate(() async {
    var response = await NominatimServiceClient(
      type: NominatimServiceType.lookup,
      lookupRequest: lookupRequest,
      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();
  });
}