一个简单的包,该包使用url_launcher在所有平台上以适当的方案启动地图应用。
在iOS上,将启动Apple指定的地图链接。在Android上,使用地理意图作为记录在这里。对于网络和其他平台,该插件将仅启动Google Maps。
将此包用作库
1.依赖它
将此添加到包的pubspec.yaml文件中:
dependencies:
maps_launcher: ^1.2.0
2.安装
您可以从命令行安装软件包:
使用Flutter:
$ flutter pub get
或者,您的编辑器可能支持flutter pub get
。查看您的编辑器文档以了解更多信息。
3.导入
现在,在Dart代码中,您可以使用:
import 'package:maps_launcher/maps_launcher.dart';
使用
import 'package:maps_launcher/maps_launcher.dart'; ... MapsLauncher.launchQuery('1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA'); MapsLauncher.launchCoordinates(37.4220041, -122.0862462);