urlPath method

String urlPath()

Returns the url path if any Returns an empty string otherwise.

Implementation

String urlPath() {
  String path;
  try {
    path = window.location.pathname!;
  } catch (ex) {
    // Empty if there's a problem
    path = '';
  }
  return path;
}