path method

  1. @override
String path()
override

Implementation

@override
String path() {
  // the hash value is always prefixed with a `#`
  // and if it is empty then it will stay empty
  var path = _platformLocation.hash;
  // TODO(b/169792422): Even though `PlatformLocation.hash` is non-null, mocks
  // in tests that haven't opted into null-safety yet can still return null
  // here, so we're keeping the null check to avoid a breaking change.
  if ((path as dynamic) == null) path = '';
  // Dart will complain if a call to substring is
  // executed with a position value that extends the
  // length of string.
  return path.isEmpty ? path : path.substring(1);
}