Skip to main content

google_location_extract 1.0.2 copy "google_location_extract: ^1.0.2" to clipboard
google_location_extract: ^1.0.2 copied to clipboard

Extract rich location details from full and shortened Google Maps URLs.

example/google_location_extract_example.dart

import 'dart:developer' as developer;

import 'package:google_location_extract/google_location_extract.dart';

Future<void> main() async {
  const logName = 'google_location_extract.example';
  const parser = GoogleMapsParser();
  final directLocation = parser.parse(
    'https://www.google.com/maps/place/Accra+Mall/'
    '@5.6224,-0.1731,17z',
  );
  developer.log(directLocation.toJson().toString(), name: logName);

  final extractor = GoogleMapsLocationExtractor();
  try {
    final sharedLocation = await extractor.extract(
      'Meet me here: https://maps.app.goo.gl/example',
    );
    developer.log(sharedLocation.toJson().toString(), name: logName);
  } on LocationExtractFormatException catch (error) {
    developer.log(
      'Invalid Google Maps link: ${error.message}',
      name: logName,
      error: error,
    );
  } on LocationExtractNetworkException catch (error) {
    developer.log(
      'Could not resolve the link: ${error.message}',
      name: logName,
      error: error,
    );
  } finally {
    extractor.close();
  }
}
0
likes
160
points
37
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Extract rich location details from full and shortened Google Maps URLs.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on google_location_extract