navhost 0.2.1
navhost: ^0.2.1 copied to clipboard
A Compose-inspired declarative navigation wrapper for Flutter's Navigator 2.0 with NavController, NavHost, transitions, interceptors, and bottom sheet/dialog support.
0.2.1 #
- Apply interceptors to
showBottomSheet()andshowDialog()— a blocked or redirected path now affects declarative modals consistently withnavigate().
0.2.0 #
Async results #
navigate(),switchTo(),navigateWidget(),showBottomSheet(),showBottomSheetWidget(),showDialog(),showDialogWidget()now returnFuture<T?>that resolves when the pushed route is popped.pop([T? result])accepts an optional result forwarded to the awaiting caller.- Routes removed by
popUpTo,popUntil,popUntilWhere, orreplace/switchTohave their pending futures completed withnull. launchSingleTopskipped navigation returns the existing top entry's future instead of an immediatenull, so the caller still receives the result when the route is eventually popped.- Imperative push methods (
push,pushWidget,pushBottomSheet,pushBottomSheetWidget,pushDialog,pushDialogWidget) already returnedFuture<T?>; they now integrate consistently with the declarative result system.
Bug fixes #
- Fix nested NavHost back button:
canPopreverted to_stack.length > 1. Usingnavigator?.canPop()was stale at build time, causing the inner NavHost'sPopScopeto miss stack updates and fail to intercept the outer navigator'smaybePop().
Internal #
- Source split: imperative methods moved to
nav_controller_imperative.dart, overlay/modal methods tonav_controller_overlays.dart, path matching tonav_route_matcher.dart. - Test suite expanded to 118 tests and split into
nav_controller_test.dart(stack logic),nav_host_test.dart(rendering, transitions, back button), andnav_results_test.dart(future/result propagation).
0.1.11 #
- Broaden Dart SDK constraint from
^3.11.3to">=3.0.0"for compatibility with a wider range of Flutter versions.
0.1.10 #
- README: fix four coherence issues — nested NavHost example now uses
_tabController.routes[i].pathconsistently with the recommended pattern; fixed invalid Dart_protectedRoutes.any(to.startsWith)→_protectedRoutes.any((r) => to.startsWith(r)); removed phantomAppRoutes.settingsreference and added missingAppRoutes.orders/AppRoutes.onboardingconstants; replacedto.startsWith(AppRoutes.detail)(template string, never matches) withto.startsWith(AppRoutes.profile). - README: expand NavHost defaults transition example with all four variants (
defaultEnterTransition,defaultExitTransition,defaultPopEnterTransition,defaultPopExitTransition) — push uses fade, pop uses slide to distinguish the two directions. Add note that all transition parameters are optional.
0.1.9 #
- Add "Recommended patterns" section to README covering: route constants, typed path builders (
DetailPage.path()andAppRoutes.buildPath()), IDs-in-URLs philosophy, interceptors for cross-cutting concerns, andswitchTovsnavigatefor tab navigation.
0.1.8 #
- Add migration guide from duck_router — covers route definition, router setup, navigation, and interceptors, with a comparison table of the key trade-offs between the two routers.
0.1.7 #
BottomSheetConfig.heightFactoris now nullable. Whennull(the new default), bottom sheets size to their content instead of being constrained to a fixed screen fraction. Pass an explicit value (e.g.heightFactor: 0.85) to restore the previous behaviour.
0.1.6 #
- Update README getting started snippet to use
^latestfor the version constraint.
0.1.5 #
- Add "Using with other libraries" section with integration examples for Provider, Riverpod, Bloc, GetX, and get_it.
- Add table of contents to README.
0.1.4 #
- Fix README examples to use two-param route builders.
0.1.3 #
- Breaking:
NavWidgetBuildernow receives two parameters:params(path) andqueryParams(query string). Update route builders from(_)to(_, _). - Query parameters are parsed from navigation paths and deep link URLs.
NavBackStackEntryexposesqueryParamsalongsideparams.- Deep links now preserve query parameters (e.g.
myapp://item/42?ref=email). - Add migration guides from GoRouter, auto_route, Navigator 1.0, and GetX.
0.1.2 #
- Add navhost_state companion package teaser to README.
0.1.1 #
- Add dartdoc comments to all public API elements (library, classes, constructors, fields, methods, typedefs, enums, and extensions).
0.1.0 #
- Initial release.
NavControllerwith declarative navigation (navigate, pop, popUntil, switchTo, replace).NavHostwidget with Compose-style 4-way transitions (enter, exit, popEnter, popExit).- Route-level and NavHost-level default transitions.
launchSingleTopandpopUpTo/popUpToInclusivenavigation options.NavInterceptorfor pre-navigation guards (redirect / block).- Back stack observation (
backStack,currentEntry,previousEntry). - Bottom sheet and dialog navigation (declarative and imperative with results).
- Inline widget navigation (
navigateWidget,pushWidget). - Path parameter extraction (e.g.
/item/:id). BuildContextextensions (navController,navigator).