nocterm library

Classes

GuardAllow
A GuardResult that permits navigation.
GuardBlock
A GuardResult that denies navigation.
GuardContext
Immutable navigation snapshot passed to each Guard.
GuardRedirect
A GuardResult that requests navigation redirection.
GuardResult
The outcome returned by a Guard.
History
A minimal browser-like history abstraction.
HistoryEvent
A navigation event emitted by History.listen.
HistoryLocation
The current location for a History implementation.
Inlet
Nocterm route declaration used by createRouter.
MemoryHistory
An in-memory History implementation.
Outlet
Renders the next matched view in the active nested route chain.
OutletScope
Inherited scope used by Outlet to resolve nested views by depth.
RouteNode<V>
Platform-agnostic route declaration.
RouteRecord<V>
Compiled route data for a matched absolute path.
RouterView
Renders the currently matched Unrouter route chain in a Nocterm app.
RouteScopeProvider
Inherited route scope used by route hooks and Outlet.

Enums

HistoryAction
The kind of navigation that produced the current location.
HistoryStrategy
Strategies available for web history creation.

Extension Types

RouteParams
Typed helpers for matched route params.
URLSearchParams
Typed helpers over ht.URLSearchParams.

Functions

createHistory({String? base, HistoryStrategy strategy = .browser}) History
Creates a History based on the current platform.
createRouter({required Iterable<Inlet> routes, Iterable<Guard>? guards, String base = '/', int maxRedirectDepth = 8, History? history, HistoryStrategy strategy = HistoryStrategy.browser}) Unrouter
Creates a Nocterm router backed by core.createRouter.
defineGuard(Guard guard) Guard
Returns the provided guard unchanged.
useFromLocation(BuildContext context) HistoryLocation?
Returns the previous accepted location, if any.
useLocation(BuildContext context) HistoryLocation
Returns the current location from the nearest route scope.
useQuery(BuildContext context) URLSearchParams
Returns query params from the nearest route scope.
useRouteMeta(BuildContext context) Map<String, Object?>
Returns merged route metadata from the nearest route scope.
useRouteParams(BuildContext context) RouteParams
Returns matched route params from the nearest route scope.
useRouter(BuildContext context) Unrouter
Returns the active Unrouter instance from the nearest route scope.
useRouteState<T>(BuildContext context) → T?
Returns typed navigation state from the nearest route scope.
useRouteURI(BuildContext context) Uri
Returns the current URI from the nearest route scope.

Typedefs

Guard = FutureOr<GuardResult> Function(GuardContext context)
Evaluates whether a navigation attempt should continue.
HistoryListener = void Function(HistoryEvent event)
RouterListener = void Function()
Listener used by Unrouter adapters to observe accepted location changes.
Unrouter = Unrouter<Component>
Nocterm-specialized Unrouter type alias.
ViewBuilder = ViewBuilder<Component>
Builds a Nocterm component for a matched route segment.