如何在flatter中启动URL?
注意:关于这个问题,我已经搜索了很多年了&阅读了StackOverflow上所有类似的问题 我正在制作颤振应用程序,我想在点击按钮时启动一个URL(基于画布) 一切都很好,直到我使用“url_启动器” 我使用的是颤振1.13.6(最新版本) 下面是我正在使用的重定向函数如何在flatter中启动URL?,url,flutter,mobile,Url,Flutter,Mobile,注意:关于这个问题,我已经搜索了很多年了&阅读了StackOverflow上所有类似的问题 我正在制作颤振应用程序,我想在点击按钮时启动一个URL(基于画布) 一切都很好,直到我使用“url_启动器” 我使用的是颤振1.13.6(最新版本) 下面是我正在使用的重定向函数 import 'package:url_launcher/url_launcher.dart' as URLLaucher; abstract class URL { static launchURL(String url
import 'package:url_launcher/url_launcher.dart' as URLLaucher;
abstract class URL {
static launchURL(String url) async {
url = Uri.encodeFull(url);
if (await URLLaucher.canLaunch(url)) {
await URLLaucher.launch(url);
} else {
throw 'Unknown error, can\'t launch the URL. Холбоост нэвтрэхэд алдаа гарлаа';
}
}
}
这是我运行“颤振运行”命令时得到的错误日志
当您在pubspec.yaml中添加了某些内容后进行热重启时,就会发生这种情况-只需关闭应用程序并再次安装即可我也遇到了同样的错误。
因此,我将颤振升级到
v1.12.13
,并使用url\u launcher5.3.0
,它成功了。您能尝试访问吗?您似乎无法下载等级文件。您的url_启动器版本和颤振版本~sdk:“>=2.3.0在这里是相同的,不管怎样
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':url_launcher'.
> Could not resolve all artifacts for configuration ':url_launcher:classpath'.
> Could not download gradle.jar (com.android.tools.build:gradle:3.4.2)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.jar'.
> Read timed out
> Could not download builder.jar (com.android.tools.build:builder:3.4.2)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.4.2/builder-3.4.2.jar'.
> Premature end of Content-Length delimited message body (expected: 31038805; received: 2359280
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':url_launcher' of type org.gradle.api.Project.
> Could not find method implementation() for arguments [project ':url_launcher_web'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
> Could not find method implementation() for arguments [project ':url_launcher_macos'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org