nova_geocoder 2.0.0 copy "nova_geocoder: ^2.0.0" to clipboard
nova_geocoder: ^2.0.0 copied to clipboard

A package to transform a description of a location i.e. street address, town name into latitude and longitude and vice versa.

Nova Geocoder Pub #

A package to transform a description of a location i.e. street address, town name into latitude and longitude and vice versa.

This package uses Google Maps Geocoding API and requires an API key. Please check this link out to obtain your API key.

🍭 Remember to enable Geocoding API for your API key.

Sample Usage #

import 'package:nova_geocoder/nova_geocoder.dart';

final geocoder = Geocoder(apiKey: 'api-key')
  ..setLanguage('en')
  ..setRegion('us');

final response1 = await geocoder.fromLatLng(37.773972, -122.431297);
if (!response1.isSuccess) {
  print('Response 1 error: ${response1.errorMessage}\n');
} else {
  print('Response 1 \n');
  final location = response1.results.first;
  print(location.geometry.location);
  print(location.geometry.bounds);
  print(location.geometry.viewport);
  print(location.formattedAddress);
}

final response2 = await geocoder.fromAddress('Golden Gate Heights');
if (!response2.isSuccess) {
  print('Response 2 error: ${response2.errorMessage}\n');
} else {
  print('Response 2 \n');
  final location = response2.results.first;
  print(location.geometry.location);
  print(location.geometry.bounds);
  print(location.geometry.viewport);
  print(location.formattedAddress);

  final simpleAddress = location.getSimpleAddress();
  print(simpleAddress.location);
  print(simpleAddress.city);
  print(simpleAddress.country);
}

geocoder.dispose();
1
likes
120
pub points
59%
popularity

Publisher

unverified uploader

A package to transform a description of a location i.e. street address, town name into latitude and longitude and vice versa.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

nova_google_services_core

More

Packages that depend on nova_geocoder