gotoAMap static method

Future<bool> gotoAMap(
  1. dynamic longitude,
  2. dynamic latitude
)

AMap / 高德地图

Implementation

static Future<bool> gotoAMap(longitude, latitude) async {
  var url = '${Platform.isAndroid ? 'android' : 'ios'}amap://navi?sourceApplication=amap&lat=$latitude&lon=$longitude&dev=0&style=2';

  bool canLaunchMap = await canLaunchUrl(Uri.parse(url));

  if (!canLaunchMap) {
    Utils.toast(('未检测到高德地图')); // "Not detect AMap"
    return false;
  }

  await launchUrl(
    Uri.parse(url),
    mode: LaunchMode.externalApplication,
  );

  return true;
}