nav_bridge 3.0.2
nav_bridge: ^3.0.2 copied to clipboard
A router-agnostic navigation layer for Flutter with testable guards and progressive GoRouter migration.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
3.0.2 - 2025-01-25 #
Fixed #
- Fixed
RouteDefinitionassertion error in_runGuards()when evaluating guards- Changed
RouteDefinition(path: location)toRouteDefinition.stub(location) - This was causing crashes when authenticated users navigated to protected routes
- Changed
3.0.1 - 2025-01-25 #
Fixed #
- Shortened package description to meet pub.dev guidelines (60-180 characters)
- Renamed example file to
example.dartfor pub.dev discovery - Expanded go_router version constraint to support v15-v17
3.0.0 - 2025-01-25 #
Breaking Changes #
AuthenticationGuard→RiverpodAuthenticationGuardRoleGuard→RiverpodRoleGuardRouterAdapterinterface extended (implementers must add new methods)
Added #
- Named navigation:
goNamed,pushNamed,replaceNamed - Type-safe navigation with
TypedRoute NavBridgeRoute- router-agnostic route definitionsNavBridgeShellRoute- shell/tab navigationGuardOrchestrator- automatic guard managementNavBridgeNavigationService- navigation service with modalsRouteParams- type-safe parameter accessGoRouterAdapter.fromRoutesfactory
Deprecated #
AuthenticationGuard(useRiverpodAuthenticationGuard)RoleGuard(useRiverpodRoleGuard)
2.0.0 - 2025-01-17 #
Major Release - Enterprise Ready #
This release introduces Wrap Mode and Progressive Migration, making Nav Bridge adoptable by existing enterprise applications without requiring a full rewrite.
Added #
Core Features
- Wrap Mode:
GoRouterAdapter.wrap()- wrap existing GoRouter without changes - GuardContext with DI: Full dependency injection support via
extrasmap - Riverpod Support:
RiverpodRouteGuardbase class withRefaccess - Guard Bridges: Adapt existing guards without modifications
GoRouterGuardBridge- for guards with(BuildContext, GoRouterState, Ref)SimpleGoRouterGuardBridge- for guards without RefGoRouterRedirectBridge- for redirect functionsGuardManagerBridge- for guard manager patterns
- InMemoryAdapter: Unit test navigation without Flutter UI
- Shell Navigation: Full
StatefulShellRoutesupport
Guard System
GuardResultsealed class withallow(),redirect(),reject()- Guard priority system (higher priority runs first)
appliesToandexcludespattern matchingCompositeGuard(AND logic) andAnyGuard(OR logic)
Testing
InMemoryAdapterwith navigation history trackingNavigationEventrecording for detailed test assertions- Mock-friendly guard interfaces
Migration Guide #
From v1.x
If you were using v1.x, the migration is straightforward:
// v1.x - Required creating new router
final adapter = GoRouterAdapter.create(routes: [...]);
// v2.0 - Can wrap existing router (recommended)
final adapter = GoRouterAdapter.wrap(existingGoRouter);
For New Adopters
See the README for the progressive migration guide.
Breaking Changes #
GuardResultis now a sealed class (use pattern matching)canActivatenow receivesGuardContextinstead of individual parameters
1.0.0 - 2025-01-01 #
2.1.0 Planned #
- AutoRoute adapter
- Typed route code generation
- Analytics observers
2.2.0 Planned #
- Beamer adapter
- Transition abstraction
- Deep link validation
