UrlLauncherUtils class

Name: URL跳转工具类 基于 url_launcher 注意使用此功能需要添加权限 在Android上,需要在AndroidManifest.xml中添加:

Constructors

UrlLauncherUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

launchInApp(String url) Future<bool>
WebView打开url url 跳转的url https://flutter.cn 若不支持WebView则返回false
launchInBrowser(String url) Future<bool>
浏览器打开url url 跳转的url https://flutter.cn 若不支持浏览器则返回false
launchInNonBrowser(String url) Future<bool>
非浏览器第三方应用打开url url 跳转的url https://flutter.cn 若不支持非浏览器第三方应用则返回false
onCall(String phoneNumber) Future<bool>
打电话 phoneNumber 电话号码 10086 若不支持打电话则返回false
onCanLaunchUrl(String url) Future<bool>
是否支持该url打开 url 跳转的url
onCloseInAppWebView() Future<void>
关闭WebView
openFile(String filePath) Future<bool>
打开文件 filePath 文件路径 /storage/emulated/0/Download/xxx.pdf 若不支持打开文件则返回false 由于Android 7.0 以上版本的限制,无法直接通过file://的方式来打开文件,需要通过FileProvider来打开
sendEmail(String mailAddress, {String subject = '', String content = ''}) Future<bool>
发送邮件 mailAddress 邮箱地址 smith@example.org?subject=News&body=New%20plugin 若不支持发邮件则返回false
sendSMS(String phoneNumber, {String content = ''}) Future<bool>
发短信 phoneNumber 电话号码 10086 若不支持发短信则返回false