BloomRouter class

Central Bloom router orchestrating declarative navigation, deep links, and route guards.

Wraps GoRouter with Bloom guard execution, type-safe navigation helpers, and DevTools inspection capabilities.

Example:

final router = BloomRouter.create(
  routes: [
    BloomRouter.route(
      path: '/',
      builder: (context, match) => const HomeScreen(),
    ),
  ],
);

Constructors

BloomRouter()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

instance → GoRouter
Get the active GoRouter instance.
no setter
isInitialized → bool
Whether the GoRouter instance has been created and mounted.
no setter
rootNavigatorKey → GlobalKey<NavigatorState>
Global navigator key attached to the root Flutter Navigator.
final

Static Methods

create({required List<RouteBase> routes, String initialLocation = '/', List<BloomGuard> globalGuards = const [], Widget errorBuilder(BuildContext, GoRouterState)?, List<NavigatorObserver>? observers, bool debugLogDiagnostics = false}) → GoRouter
Creates and configures the GoRouter instance from route definitions and guards.
currentLocation(BuildContext context) → String
Returns the current route URI string from the given context.
dumpRouter() → Map<String, dynamic>
Dumps the current router state for DevTools inspection.
go(String location, {Object? extra}) → void
Navigates to location replacing the current navigation stack.
pop<T>([T? result]) → void
Pops the topmost route off the navigation stack with an optional result.
push<T>(String location, {Object? extra}) → Future<T?>
Pushes a new location onto the navigation stack.
replace(String location, {Object? extra}) → void
Replaces the current route on the navigation stack with location.
route({required String path, required Widget builder(BuildContext context, BloomRouteMatch match), String? name, List<BloomGuard> guards = const [], List<RouteBase> routes = const []}) → GoRoute
Helper to create a GoRoute with Bloom route match and guard resolution.
shell({required Widget builder(BuildContext context, GoRouterState state, Widget child), required List<RouteBase> routes, GlobalKey<NavigatorState>? navigatorKey}) → ShellRoute
Helper to create a nested persistent tab / shell route.