RouterLink class

A link that navigates via the router without reloading the page.

Handles smooth scrolling for hash links and same-page navigation. Works on both web and server (renders as plain anchor on server).

Inheritance

Constructors

RouterLink({required String to, Object? key, Component? child, String? label, String? activeClass, bool exact = false, String? className, Style? style, String? id})

Properties

activeClass String?
CSS class to add when the route is active.
final
child Component?
The child component (overrides label).
final
className String?
final
css String?
Component-level CSS styles.
no setterinherited
exact bool
Whether to match the route exactly for active state.
final
hashCode int
The hash code for this object.
no setterinherited
id String?
final
isDirty bool
Whether this component needs rebuild.
no setterinherited
isMounted bool
Whether this component is mounted.
no setterinherited
key Object?
Unique identifier for this component within its parent.
finalinherited
label String?
The link text (if child is null).
final
mounted bool
Whether this component is mounted (alias for isMounted).
no setterinherited
onNeedRebuild RebuildCallback?
Sets the rebuild callback.
no getterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scopeId String
Unique identifier for CSS scoping.
no setterinherited
style Style?
final
styleSheet Map<String, Style>
Component-level scoped styles using typed records.
no setterinherited
to String
The target path.
final

Methods

build() Component
Builds the component's content.
override
clearDirty() → void
Clears the dirty flag.
inherited
layout() Component?
The layout wrapper for this component.
inherited
markDirty() → void
Marks this component as needing rebuild.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onMount() → void
Called when mounted to the tree.
inherited
onUnmount() → void
Called before removal from tree.
inherited
registerEffect(CleanupFn? effectFn()) → void
Registers an effect disposed on unmount.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited