shareDestination method

Future shareDestination({
  1. required Location destination,
  2. NaviOption? option,
  3. List<Location>? viaList,
})

KO: 카카오내비 앱으로 목적지 공유 실행, 모바일 기기에서만 동작
destination에 목적지 전달
option에 경로 검색 옵션 전달
viaList에 경유지 목록 전달(최대: 3개)

EN: Launches the Kakao Navi app to show the shared destination, available only on the mobile devices
Pass the destination to destination
Pass the options for searching the route to option
Pass the list of stops to viaList (Maximum: 3 places)

Implementation

Future shareDestination(
    {required Location destination,
    NaviOption? option,
    List<Location>? viaList}) async {
  final shareNaviOption = NaviOption(
      coordType: option?.coordType,
      vehicleType: option?.vehicleType,
      rpOption: option?.rpOption,
      routeInfo: true,
      startX: option?.startX,
      startY: option?.startY,
      startAngle: option?.startAngle);

  String naviScheme = _getKakaoNaviScheme();
  final extras = await _getExtras();
  final arguments = {
    Constants.naviScheme: naviScheme,
    Constants.appKey: KakaoSdk.appKey,
    Constants.extras: jsonEncode(extras),
    Constants.naviParams: jsonEncode(
      KakaoNaviParams(
        destination: destination,
        option: shareNaviOption,
        viaList: viaList,
      ),
    )
  };
  await _channel.invokeMethod<bool>(
      CommonConstants.shareDestination, arguments);
}