nav_bridge 2.0.0
nav_bridge: ^2.0.0 copied to clipboard
A progressive, router-agnostic navigation layer for Flutter that allows you to wrap existing GoRouter apps and migrate to a clean, testable, decoupled architecture without rewriting your routes.
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.
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
