How to open an application from a Flutter app?

后端 未结 5 1964
不思量自难忘°
不思量自难忘° 2020-11-30 03:29

I am developing a Flutter app, in which I need to show navigation to the user for a place. So, how can I open a map application from my Flutter app like we do using external

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 04:02

    In that case you just need to use url_launcher plugin which opens your app.

    yourMap() async {
      const url = "https://www.google.com/maps/search/? 
      api=1&query=LATITUDE,LONGITUDE,17&query_place_id=PLACE_ID";
     if (await canLaunch(url)) {
       await launch(url);
     } else {
       throw 'Could not launch Maps';
      }
    }
    

    and then call this yourMap() method on your button onPress.

提交回复
热议问题