postUrl method

  1. @override
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);

NOTE for Web: it will try to create an XMLHttpRequest and load the result inside the iframe.

Officially Supported Platforms/Implementations:

Implementation

@override
Future<void> postUrl(
    {required WebUri url, required Uint8List postData}) async {
  assert(url.toString().isNotEmpty);
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent('url', () => url.toString());
  args.putIfAbsent('postData', () => postData);
  await channel?.invokeMethod('postUrl', args);
}