我试着用我的颤音应用打个电话。使用以下代码:
UrlLauncher.launch('tel: xxxxxxxx');
我在GitHub颤振回购:https://github.com/flutter/flutter/issues/4856上找到了这个函数
但这对我不管用。这个功能还在哪里,在哪一个包里?还是有更好的选择来打电话从我的应用程序?
发布于 2020-09-06 14:08:00
url是用于启动url、拨号号码和发送邮件的通用包。
url_launcher: ^5.5.2
添加到pubspec.yaml文件并运行flutter pub get
import 'package:url_launcher/url_launcher.dart';
void launchUrl(String url) async {
if (await canLaunch(url)) {
launch(url);
} else {
throw "Could not launch $url";
}
}
//for launching url
launchUrl("HTTP://example.com");
// for dial phone number
launchUrl("tel:+99364921507");
// for sending email
launchUrl("mailto:zehinz@gmail.com?subject=Meeting&body=Can we meet via Google Meet");
https://stackoverflow.com/questions/45523370
复制相似问题