getUrl method
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.
Supported Platforms/Implementations:
- Android native WebView (Official API - WebView.getUrl)
- iOS (Official API - WKWebView.url)
Implementation
Future<Uri?> getUrl() async {
Map<String, dynamic> args = <String, dynamic>{};
String? url = await _channel.invokeMethod('getUrl', args);
return url != null ? Uri.tryParse(url) : null;
}