Formatting
This commit is contained in:
parent
ddb7c6f1ee
commit
bce554ea3d
2 changed files with 7 additions and 7 deletions
|
@ -97,7 +97,8 @@ abstract class _BrowserRouterImpl<T> extends Router<T>
|
||||||
@override
|
@override
|
||||||
void listen() {
|
void listen() {
|
||||||
if (_listening) {
|
if (_listening) {
|
||||||
throw StateError('The router is already listening for page changes.');}
|
throw StateError('The router is already listening for page changes.');
|
||||||
|
}
|
||||||
_listening = true;
|
_listening = true;
|
||||||
_listen();
|
_listen();
|
||||||
}
|
}
|
||||||
|
@ -156,7 +157,8 @@ class _PushStateRouter<T> extends _BrowserRouterImpl<T> {
|
||||||
if ($base?.href?.isNotEmpty != true) {
|
if ($base?.href?.isNotEmpty != true) {
|
||||||
throw StateError(
|
throw StateError(
|
||||||
'You must have a <base href="<base-url-here>"> element present in your document to run the push state router.');
|
'You must have a <base href="<base-url-here>"> element present in your document to run the push state router.');
|
||||||
} _basePath = $base.href.replaceAll(_straySlashes, '');
|
}
|
||||||
|
_basePath = $base.href.replaceAll(_straySlashes, '');
|
||||||
if (listen) this.listen();
|
if (listen) this.listen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
/// Represents an error in route configuration or navigation.
|
/// Represents an error in route configuration or navigation.
|
||||||
abstract class RoutingException extends Exception {
|
abstract class RoutingException extends Exception {
|
||||||
factory RoutingException(String message) =>
|
factory RoutingException(String message) => _RoutingExceptionImpl(message);
|
||||||
_RoutingExceptionImpl(message);
|
|
||||||
|
|
||||||
/// Occurs when trying to resolve the parent of a [Route] without a parent.
|
/// Occurs when trying to resolve the parent of a [Route] without a parent.
|
||||||
factory RoutingException.orphan() => _RoutingExceptionImpl(
|
factory RoutingException.orphan() => _RoutingExceptionImpl(
|
||||||
"Tried to resolve path '..' on a route that has no parent.");
|
"Tried to resolve path '..' on a route that has no parent.");
|
||||||
|
|
||||||
/// Occurs when the user attempts to navigate to a non-existent route.
|
/// Occurs when the user attempts to navigate to a non-existent route.
|
||||||
factory RoutingException.noSuchRoute(String path) =>
|
factory RoutingException.noSuchRoute(String path) => _RoutingExceptionImpl(
|
||||||
_RoutingExceptionImpl(
|
"Tried to navigate to non-existent route: '$path'.");
|
||||||
"Tried to navigate to non-existent route: '$path'.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RoutingExceptionImpl implements RoutingException {
|
class _RoutingExceptionImpl implements RoutingException {
|
||||||
|
|
Loading…
Reference in a new issue