如何在flutter中将参数发送到资产文件webview



我想在assets文件夹中打开我的index.html,但有了参数,我试着这样打开:initialFile:";assets/index.html?name=foo&lastname=Bar";但它不起作用。

return Container(
child: InAppWebView(
//initialFile: "assets/index.html",
initialOptions: inAppWebViewGroupOptions,
initialUrlRequest: URLRequest(
url: Uri.parse("file:///assets/index.html"),
method: 'GET',
body:
Uint8List.fromList(utf8.encode("name=foo&lastname=Bar")),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}),
),
);
}

也许您可以设置WebView cookie来传递参数。

您可以使用In-App Localhost服务器。

最新更新