当前位置:网站首页>[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)
[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)
2022-07-02 22:09:00 【Programmer community】
List of articles
- One 、url_launcher Plug in search and installation
- 1、 Search for url_launcher plug-in unit
- 2、 install url_launcher plug-in unit
- Two 、url_launcher Official plug-in example
- 3、 ... and 、 Open the browser
- Four 、 Open a third party app
- 5、 ... and 、 Complete code example
- 6、 ... and 、 Related resources
One 、url_launcher Plug in search and installation
1、 Search for url_launcher plug-in unit
With the help of url_launcher Third party plug-ins , You can open third-party applications ;
The plug-in is Flutter Official plug-in for opening third-party applications ;
stay https://pub.dev/packages Search and install url_launcher plug-in unit ;

The address of the plug-in is https://pub.dev/packages/url_launcher

2、 install url_launcher plug-in unit
Installing a plug-in : stay https://pub.dev/packages/url_launcher/install The page has the installation method of the plug-in ;
1 . Configuration dependency : stay pubspec.yaml Configure dependencies in the configuration file ;
dependencies: url_launcher: ^5.7.102 . Get plug-ins : Click on the " Pub get " Button to get the plug-in , In the following Message The panel shows Running "flutter pub get" in flutter_cmd... 0.5s , This indicates that the plug-in has been downloaded successfully ;

3 . Import header file :
import 'package:url_launcher/url_launcher.dart';Two 、url_launcher Official plug-in example
The official sample : This is a https://pub.dev/packages/url_launcher The official code provided by ;
import 'package:flutter/material.dart';import 'package:url_launcher/url_launcher.dart';void main() {
runApp(Scaffold( body: Center( child: RaisedButton( onPressed: _launchURL, child: Text('Show Flutter homepage'), ), ), ));}_launchURL() async {
const url = 'https://flutter.dev'; if (await canLaunch(url)) {
await launch(url); } else {
throw 'Could not launch $url'; }}3、 ... and 、 Open the browser
Set up RaisedButton Button components , Click this button , Open browser automatically , And open the home page of this blog ;
// Open browser button RaisedButton( // Anonymous functions onPressed: () async {
const url = 'https://blog.csdn.net/shulianghan'; if (await canLaunch(url)) {
await launch(url); } else {
throw 'Could not launch $url'; } }, // The components displayed by the button child: Text(" Open the browser "),),Four 、 Open a third party app
The premise of opening third-party applications is , Know the of the application schema or url , These are all made by third parties app The developers of ;
Google maps scheme yes “geo: precision , dimension ” ;
Apple map url yes “http://maps.apple.com/?ll= precision , dimension ”
// open Google Map RaisedButton( // Anonymous functions onPressed: () async {
// Android Google maps scheme , Behind is the latitude and longitude of Haidian District, Beijing const url = 'geo:116.3,39.95'; if (await canLaunch(url)) {
// Android mobile phone , open Google Map await launch(url); } else {
// If the Android phone doesn't open, it means it's an Apple phone const url_ios = 'http://maps.apple.com/?ll=116.3,39.95'; if (await canLaunch(url_ios)) {
await launch(url_ios); } else {
throw 'Could not launch $url'; } } }, // The components displayed by the button child: Text(" Open the map "),),5、 ... and 、 Complete code example
Complete code example :
import 'package:flutter/material.dart';import 'package:url_launcher/url_launcher.dart';class LauncherPage extends StatefulWidget {
@override _LauncherPageState createState() => _LauncherPageState();}class _LauncherPageState extends State<LauncherPage> {
@override Widget build(BuildContext context) {
return MaterialApp( title: " Third party application jump ", theme: ThemeData(primarySwatch: Colors.blue), home: Scaffold( appBar: AppBar( title: Text(" Third party application jump "), leading: GestureDetector( onTap: (){
Navigator.pop(context); }, child: Icon(Icons.arrow_back_ios), ), ), body: Container( // centered alignment: Alignment.center, // Vertical linear layout child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ // Open browser button RaisedButton( // Anonymous functions onPressed: () async {
const url = 'https://blog.csdn.net/shulianghan'; if (await canLaunch(url)) {
await launch(url); } else {
throw 'Could not launch $url'; } }, // The components displayed by the button child: Text(" Open the browser "), ), // open Google Map RaisedButton( // Anonymous functions onPressed: () async {
// Android Google maps scheme , Behind is the latitude and longitude of Haidian District, Beijing const url = 'geo:116.3,39.95'; if (await canLaunch(url)) {
// Android mobile phone , open Google Map await launch(url); } else {
// If the Android phone doesn't open, it means it's an Apple phone const url_ios = 'http://maps.apple.com/?ll=116.3,39.95'; if (await canLaunch(url_ios)) {
await launch(url_ios); } else {
throw 'Could not launch $url'; } } }, // The components displayed by the button child: Text(" Open the map "), ), ], ), ), ), ); }}Running effect :

6、 ... and 、 Related resources
Reference material :
- Flutter Official website : https://flutter.dev/
- Flutter Plug in download address : https://pub.dev/packages
- Flutter Developing documents : https://flutter.cn/docs ( Strongly recommend )
- official GitHub Address : https://github.com/flutter
- Flutter The Chinese community : https://flutter.cn/
- Flutter Practical tutorial : https://flutter.cn/docs/cookbook
- Flutter CodeLab : https://codelabs.flutter-io.cn/
- Dart Chinese document : https://dart.cn/
- Dart Developer website : https://api.dart.dev/
- Flutter Chinese net ( unofficial , The translation is very good ) : https://flutterchina.club/ , http://flutter.axuer.com/docs/
- Flutter Related issues : https://flutterchina.club/faq/ ( It is recommended to watch it at the introductory stage )
Blog source download :
GitHub Address : https://github.com/han1202012/flutter_cmd ( Keep updating with the progress of the blog , There may not be the source code of this blog )
Blog source snapshot : https://download.csdn.net/download/han1202012/15541330 ( The source code snapshot of this blog , You can find the source code of this blog )
边栏推荐
- GEE:(二)对影像进行重采样
- D4:非成对图像去雾,基于密度与深度分解的自增强方法(CVPR 2022)
- scrcpy这款软件解决了和同事分享手机屏幕的问题| 社区征文
- Web side defense Guide
- tinymce可视化编辑器增加百度地图插件
- The failure rate is as high as 80%. What should we do about digital transformation?
- What is it that makes you tremble? Those without fans can learn
- Daily book - low code you must understand in the era of digital transformation
- Les trois principaux points de douleur traités par servicemesh
- 如何访问kubernetes API?
猜你喜欢

Interpretation of CVPR paper | generation of high fidelity fashion models with weak supervision

GEE:(二)对影像进行重采样

Five message formats of OSPF

Infrastructure is code: a change is coming

An overview of the development of affective computing and understanding research
![[zero foundation I] Navicat download link](/img/23/e7808884152eeaf186fe756d6adac6.png)
[zero foundation I] Navicat download link

MySQL learning record (4)

Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?

情感计算与理解研究发展概述

#include<>和#include“”的区别
随机推荐
Free open source web version of xshell [congratulations on a happy new year]
Structure array, pointer and function and application cases
Interpretation of CVPR paper | generation of high fidelity fashion models with weak supervision
Five message formats of OSPF
Leetcode theme [array] -169- most elements
如何访问kubernetes API?
Find objects you can't see! Nankai & Wuhan University & eth proposed sinet for camouflage target detection, and the code has been open source
Riding the wind of "cloud native" and stepping on the wave of "digitalization", new programmer 003 starts pre-sale
【剑指 Offer】56 - I. 数组中数字出现的次数
Blue Bridge Cup Eliminate last one (bit operation, code completion)
How to prevent your jar from being decompiled?
Centos7 installation and configuration of redis database
How to center the positioned text horizontally and vertically
"New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba
GEE:(二)对影像进行重采样
《Just because》阅读感受
使用 EMQX Cloud 实现物联网设备一机一密验证
Daily book CSO advanced road first exposed
"Actbert" Baidu & Sydney University of technology proposed actbert to learn the global and local video text representation, which is effective in five video text tasks!
【C 题集】of Ⅴ