useRouter function
Returns the active Unrouter instance from the nearest route scope.
Implementation
Unrouter useRouter(BuildContext context) {
final scope = context
.dependOnInheritedComponentOfExactType<RouteScopeProvider>();
if (scope != null) return scope.router;
throw StateError('Unrouter router is unavailable in this context.');
}