currentUri property

  1. @override
Uri get currentUri
override

The currently active uri. On the server, this is the requested uri. On the client, this is the currently visited uri in the browser.

Implementation

@override
Uri get currentUri {
  if (_baseOrigin.length > window.location.href.length) {
    return Uri(path: '/');
  }
  var pathWithoutOrigin = window.location.href.substring(_baseOrigin.length);
  if (!pathWithoutOrigin.startsWith('/')) {
    pathWithoutOrigin = '/$pathWithoutOrigin';
  }
  return Uri.parse(pathWithoutOrigin);
}