currentUrl property

  1. @override
String get currentUrl
override

The currently active url.

On the server, this is the request url. On the client, this is the currently visited url in the browser.

Implementation

@override
String get currentUrl {
  if (_baseOrigin.length > web.window.location.href.length) {
    return '/';
  }
  var pathWithoutOrigin = web.window.location.href.substring(_baseOrigin.length);
  if (!pathWithoutOrigin.startsWith('/')) {
    pathWithoutOrigin = '/$pathWithoutOrigin';
  }
  return pathWithoutOrigin;
}