getUrl method Null safety

Future<Uri?> getUrl()

Gets the URL for the current page. This is not always the same as the URL passed to WebView.onLoadStart because although the load for that URL has begun, the current page may not have changed.

Official Android API: https://developer.android.com/reference/android/webkit/WebView#getUrl()

Official iOS API: https://developer.apple.com/documentation/webkit/wkwebview/1415005-url

Implementation

Future<Uri?> getUrl() async {
  Map<String, dynamic> args = <String, dynamic>{};
  String? url = await _channel.invokeMethod('getUrl', args);
  return url != null ? Uri.parse(url) : null;
}