postUrl method

Future<void> postUrl({
  1. required WebUri url,
  2. required Uint8List postData,
})

Loads the given url with postData (x-www-form-urlencoded) using POST method into this WebView.

Example:

var postData = Uint8List.fromList(utf8.encode("firstname=Foo&surname=Bar"));
controller.postUrl(url: WebUri("https://www.example.com/"), postData: postData);

Officially Supported Platforms/Implementations:

  • Android WebView (Official API - WebView.postUrl)
  • iOS WKWebView
  • macOS WKWebView
  • Web <iframe> but requires same origin:
    • It will try to create an XMLHttpRequest and load the result inside the iframe.
  • Windows WebView2
  • Linux WPE WebKit:
    • Uses JavaScript to create an XMLHttpRequest and load the result.

Parameters - Officially Supported Platforms/Implementations:

  • url: all platforms
  • postData: all platforms

Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.

Implementation

Future<void> postUrl({required WebUri url, required Uint8List postData}) =>
    platform.postUrl(url: url, postData: postData);