[英]launch method in Flutter url_launcher dart package is deprecated, but launchURL does not have forceSafariVC parameter
"launch" method in Flutter url_launcher dart package is deprecated, and it needs to be replaced to launchURL. Flutter url_launcher dart package 中的“launch”方法已弃用,需要替换为launchURL。 But launchURL method does not have forceSafariVC parameter.
但是 launchURL 方法没有 forceSafariVC 参数。
How would the migration to this new method look like considering the forceSafariVC parameter?考虑到 forceSafariVC 参数,迁移到这种新方法会是什么样子?
Use LaunchMode instead.请改用LaunchMode 。
replace forceSafariVC and forceWebView with LaunchMode, which makes the API platform-neutral, and standardizes the default behavior between Android and iOS.
将 forceSafariVC 和 forceWebView 替换为 LaunchMode,这使得 API 平台中立,并标准化了 Android 和 iOS 之间的默认行为。
You need to use LaunchMode
.您需要使用
LaunchMode
。 In general (but not in all cases):一般来说(但并非在所有情况下):
forceSafariVC: false
translates to mode: LaunchMode.externalApplication
. forceSafariVC: false
转换为mode: LaunchMode.externalApplication
。
forceSafariVC: true
translates to mode: LaunchMode.inAppWebView
. forceSafariVC: true
转换为mode: LaunchMode.inAppWebView
。
If your app has also non-mobile targets (macOS, Windows, Linux, Web), then you might want to use different modes.如果您的应用也有非移动目标(macOS、Windows、Linux、Web),那么您可能需要使用不同的模式。
If you need to handle universal links, then you might want to use如果您需要处理通用链接,那么您可能需要使用
final nativeAppLaunchSucceeded = await launchUrl(
url,
mode: LaunchMode.externalNonBrowserApplication,
);
if (!nativeAppLaunchSucceeded) {
await launchUrl(
url,
mode: LaunchMode.inAppWebView,
);
}
See the official example .见官方例子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.