nearby method
Locate businesses around latitude
and longitude
coords
Implementation
Future<Iterable<BusinessInfo>> nearby(
{String? name,
required double latitude,
required double longitude,
int radius = 500}) async {
final locale = PlatformDispatcher.instance.locales.first;
final queryParameters = {
'location': '$latitude,$longitude',
'radius': radius,
'language': locale.languageCode
};
if (name != null) queryParameters['name'] = name;
final data = await _apiRequest('place/nearbysearch/json',
queryParameters: queryParameters);
return (data['results'] as List).map((e) => BusinessInfo.fromJson(e));
}