assertValid method
Runs a dev-mode assertion that the definition is valid.
When assertions are enabled, throws StateError. Otherwise does nothing.
Implementation
@override
void assertValid() {
if (!isDevMode) {
return;
}
if (redirectTo == path) {
throw StateError('Cannot redirect from `redirectTo` to `path');
}
var pathParameters = parameters;
var unknownRedirectToParameters = _redirectToParameters.where(
(redirectToParameter) => !pathParameters.contains(redirectToParameter));
if (unknownRedirectToParameters.isNotEmpty) {
throw StateError('Parameters in `redirectTo` are not in `path`: '
'$unknownRedirectToParameters');
}
}