openMap static method

dynamic openMap(
  1. double lat,
  2. double lng
)

Implementation

static openMap(double lat, double lng) async {
  String googleUrl =
      'https://www.google.com/maps/search/?api=1&query=$lat,$lng';
  if (await canLaunchUrl(Uri.parse(googleUrl))) {
    await launchUrl(Uri.parse(googleUrl), mode: LaunchMode.externalApplication);
  } else {
    throw 'Unable open the map.';
  }
}