android - 如何在 Flutter 的 WebView 中使用 post 方法
问题描述
我想在 Flutter 的 webView 中使用 JSON 格式的数据集进行发布请求。在这里找不到出路。我已经尝试过flutter_inappwebview 4.0.0+4但到目前为止还没有运气。这是我的代码片段:
InAppWebView(
initialHeaders: header,
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
debuggingEnabled: true,
)),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
webView.postUrl(
url: url,
postData: utf8.encode(postData.toString()));
},
onLoadStart: (InAppWebViewController controller, String url) {
setState(() {
this.url = url;
});
},
onLoadStop:
(InAppWebViewController controller, String url) async {
setState(() {
this.url = url;
});
},
onProgressChanged:
(InAppWebViewController controller, int progress) {
setState(() {
this.progress = progress / 100;
});
},
),
这里header
和postdata
两者都是 JSON 格式的数据集。有没有办法解决这个问题?提前致谢。
解决方案
推荐阅读
- google-app-engine - 在应用引擎开发中使用 google.cloud 库时出现 ImportError
- php - 为什么日志不显示 API 发送的请求信息?
- java - 将字符串地址转换为 lat 和 lng 大约需要 1 秒
- android - 将 SeekBarPreference 样式设置为与 SwitchPreference 一致
- php - 无法在 Windows Server 2016 上加载 pdo 驱动程序
- python - 在 Datetime 上合并两个数据集
- android - 添加发布方法(MediaPlayer)后应用无法运行
- javascript - 在本地将 XSLT 应用于 XML,无需服务器
- javascript - Leaflet图层控件中图层的排序顺序
- clojure - 如何将profiles.clj 加载到CURSIVE REPL 中?