3 回答

TA貢獻1783條經驗 獲得超4個贊
之前,當 Firebase 動態鏈接被強制加載到 WebView 中時,我在 Android 上遇到了類似的錯誤。就我而言,FDL 預計將由 Android 中的 Google Play 服務處理。但是由于 WebView 不知道如何處理它被迫顯示的鏈接,WebView 返回“net::ERR_UNKNOWN_URL_SCHEME”錯誤。我不確定這是否與您的情況相同,因為我無法驗證您嘗試從“intent://kakaopay...”加載的鏈接
您可以嘗試使用外部打開鏈接url_launcher
。使用 RegEx 過濾意圖 URL 并檢查 URL 是否可以在外部(應用程序外部)啟動和處理。
var yourURL = "URL goes here";
// Check if URL contains "intent"
yourURL.contains(RegExp('^intent://.*\$')){
? // Check if the URL can be launched
? if (await canLaunch(yourURL)) {
? ? await launch(yourURL);
? } else {
? ? print('Could not launch $yourURL');
? }
}
此外,您使用的插件 (?web_view_plugin
) 似乎已過時,我無法在此處找到它https://pub.dev/packages?q=web_view_plugin。Flutter 有它的官方 WebView 插件 (?webview_flutter
) 已經發布,我建議檢查它是否適合你的用例。

TA貢獻1842條經驗 獲得超13個贊
這樣做了:
_launchURL(url) async {
? var link = "https://hiddenwords.page.link/deposit";
? if (await canLaunch(link)) {
? ? ? await launch(link,
? ? ? forceWebView: false, enableJavaScript: true, forceSafariVC:?
? ? false);
? } else {
? ? throw 'Could not launch $link';
? }
}
我手動將我希望它在 _launch 函數中打開的 url/鏈接放在 _launch 函數中...不要介意 _launch 括號中的 url。
我還將此添加到 Webview 小部件:
navigationDelegate: (NavigationRequest request) {
? ?if (request.url.contains(RegExp('^intent://.*\$')))? {
? ? ? ? _launchURL(request.url);
? ? ? ? return NavigationDecision.prevent;
? ?}
? ? ?return NavigationDecision.navigate;
},
希望這對你有用。這個對我有用...

TA貢獻1880條經驗 獲得超4個贊
1.使用你的APP在flutter中使用參數打開其他應用程序(在你的動態鏈接中);2.使用:url_launcher:^6.1.6;
首先,他們的應用程序必須支持動態鏈接;其次,他們為您提供交易的動態鏈接;這樣我們就可以點擊你APP中的動態鏈接,跳轉到他們APP的指定頁面了。
代碼:
final Uri toLaunch = Uri(scheme: 'https', host: 'link.fitstop.com', path: 'link/qbvQ/');
//https://link.fitstop.com/link/qbvQ is dynamic link
Future<void>? _launched;
ElevatedButton(
onPressed: () => setState(() {
_launched = _launchInBrowser(toLaunch);
}),
child: Text(
'url_launcher',
),
)
Future<void> _launchInBrowser(Uri url) async {
if (!await launchUrl(
url,
mode: LaunchMode.externalApplication,
)) {
throw 'Could not launch $url';
}
}
添加回答
舉報