如何在 webview-flutter Flutter 中使用 user-agent?

How to use user-agent in webview-flutter Flutter?

我尝试在 Flutter 中使用 webview_flutter 插件。但是找不到在那里设置用户代理。它应该在那里吧?这是webview的基本功能。有什么办法可以实现吗? 提前谢谢你。

尝试使用 Flutter_webview_plugin here

您可以添加以下变量(包括 userAgent),如他们的文档所示:

Future<Null> launch(String url, {
   Map<String, String> headers: null,
   bool withJavascript: true,
   bool clearCache: false,
   bool clearCookies: false,
   bool hidden: false,
   bool enableAppScheme: true,
   Rect rect: null,
   **String userAgent: null,**
   bool withZoom: false,
   bool withLocalStorage: true,
   bool withLocalUrl: true,
   bool scrollBar: true,
   bool supportMultipleWindows: false,
   bool appCacheEnabled: false,
   bool allowFileURLs: false,
});
webview_flutter: ^0.3.13

引入了用户代理,现在可以很容易地使用它了,比如

WebView(
  userAgent: "random",
  initialUrl: "",
)