nav_bridge 3.0.2 copy "nav_bridge: ^3.0.2" to clipboard
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 RouteDefinition assertion error in _runGuards() when evaluating guards
    • Changed RouteDefinition(path: location) to RouteDefinition.stub(location)
    • This was causing crashes when authenticated users navigated to protected routes

3.0.1 - 2025-01-25 #

Fixed #

  • Shortened package description to meet pub.dev guidelines (60-180 characters)
  • Renamed example file to example.dart for pub.dev discovery
  • Expanded go_router version constraint to support v15-v17

3.0.0 - 2025-01-25 #

Breaking Changes #

  • AuthenticationGuardRiverpodAuthenticationGuard
  • RoleGuardRiverpodRoleGuard
  • RouterAdapter interface extended (implementers must add new methods)

Added #

  • Named navigation: goNamed, pushNamed, replaceNamed
  • Type-safe navigation with TypedRoute
  • NavBridgeRoute - router-agnostic route definitions
  • NavBridgeShellRoute - shell/tab navigation
  • GuardOrchestrator - automatic guard management
  • NavBridgeNavigationService - navigation service with modals
  • RouteParams - type-safe parameter access
  • GoRouterAdapter.fromRoutes factory

Deprecated #

  • AuthenticationGuard (use RiverpodAuthenticationGuard)
  • RoleGuard (use RiverpodRoleGuard)

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 extras map
  • Riverpod Support: RiverpodRouteGuard base class with Ref access
  • Guard Bridges: Adapt existing guards without modifications
    • GoRouterGuardBridge - for guards with (BuildContext, GoRouterState, Ref)
    • SimpleGoRouterGuardBridge - for guards without Ref
    • GoRouterRedirectBridge - for redirect functions
    • GuardManagerBridge - for guard manager patterns
  • InMemoryAdapter: Unit test navigation without Flutter UI
  • Shell Navigation: Full StatefulShellRoute support

Guard System

  • GuardResult sealed class with allow(), redirect(), reject()
  • Guard priority system (higher priority runs first)
  • appliesTo and excludes pattern matching
  • CompositeGuard (AND logic) and AnyGuard (OR logic)

Testing

  • InMemoryAdapter with navigation history tracking
  • NavigationEvent recording 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 #

  • GuardResult is now a sealed class (use pattern matching)
  • canActivate now receives GuardContext instead of individual parameters

1.0.0 - 2025-01-01 #

Added #

  • Initial release
  • Basic GoRouterAdapter with create mode
  • RouteGuard base class
  • RouteDefinition for route configuration
  • InMemoryAdapter for testing

Upcoming #

2.1.0 Planned #

  • AutoRoute adapter
  • Typed route code generation
  • Analytics observers

2.2.0 Planned #

  • Beamer adapter
  • Transition abstraction
  • Deep link validation

1
likes
160
points
75
downloads
screenshot

Publisher

unverified uploader

Weekly Downloads

A router-agnostic navigation layer for Flutter with testable guards and progressive GoRouter migration.

Repository (GitHub)
View/report issues
Contributing

Topics

#navigation #routing #go-router #architecture #testing

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

flutter, go_router

More

Packages that depend on nav_bridge