currentUrl method

  1. @override
Future<String?> currentUrl()

Accessor to the current URL that the WebView is displaying.

If no URL was ever loaded, returns null.

Implementation

@override
Future<String?> currentUrl() async {
  final int? webviewId = instanceManager.getInstanceId(this);
  if (webviewId == null) {
    throw 'Failed to get the webview instance';
  }
  String? result = await (await LinuxWebViewPlugin.channel)
      .invokeMethod('currentUrl', <String, dynamic>{
    'webviewId': webviewId,
  });
  return result;
}