postUrl method Null safety

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

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

Official Android API: https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[])

Example

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

Implementation

Future<void> postUrl({required Uri 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);
}