Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/go_router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 14.6.2

- Fixes return type of current state getter on `GoRouter` and `GoRouterDelegate` to be non-nullable.

## 14.6.1

- Fixed `PopScope`, and `WillPopScop` was not handled properly in the Root routes.
Expand Down
2 changes: 1 addition & 1 deletion packages/go_router/lib/src/delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class GoRouterDelegate extends RouterDelegate<RouteMatchList>

/// The top [GoRouterState], the state of the route that was
/// last used in either [GoRouter.go] or [GoRouter.push].
GoRouterState? get state => currentConfiguration.last
GoRouterState get state => currentConfiguration.last
.buildState(_configuration, currentConfiguration);

/// For use by the Router architecture as part of the RouterDelegate.
Expand Down
2 changes: 1 addition & 1 deletion packages/go_router/lib/src/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class GoRouter implements RouterConfig<RouteMatchList> {
/// Accessing this property via GoRouter.of(context).state will not
/// cause rebuild if the state has changed, consider using
/// GoRouterState.of(context) instead.
GoRouterState? get state => routerDelegate.state;
GoRouterState get state => routerDelegate.state;

/// Whether the imperative API affects browser URL bar.
///
Expand Down
2 changes: 1 addition & 1 deletion packages/go_router/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: go_router
description: A declarative router for Flutter based on Navigation 2 supporting
deep linking, data-driven routes and more
version: 14.6.1
version: 14.6.2
repository: https://github.com/flutter/packages/tree/main/packages/go_router
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22

Expand Down
24 changes: 12 additions & 12 deletions packages/go_router/test/go_router_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6030,39 +6030,39 @@ void main() {
await tester.pumpAndSettle();

GoRouterState? state = router.state;
expect(state?.name, 'home');
expect(state?.fullPath, '/');
expect(state.name, 'home');
expect(state.fullPath, '/');

router.go('/books');
await tester.pumpAndSettle();
state = router.state;
expect(state?.name, 'books');
expect(state?.fullPath, '/books');
expect(state.name, 'books');
expect(state.fullPath, '/books');

router.push('/boats');
await tester.pumpAndSettle();
state = router.state;
expect(state?.name, 'boats');
expect(state?.fullPath, '/boats');
expect(state.name, 'boats');
expect(state.fullPath, '/boats');

router.pop();
await tester.pumpAndSettle();
state = router.state;
expect(state?.name, 'books');
expect(state?.fullPath, '/books');
expect(state.name, 'books');
expect(state.fullPath, '/books');

router.go('/tulips');
await tester.pumpAndSettle();
state = router.state;
expect(state?.name, 'tulips');
expect(state?.fullPath, '/tulips');
expect(state.name, 'tulips');
expect(state.fullPath, '/tulips');

router.go('/books');
router.push('/tulips');
await tester.pumpAndSettle();
state = router.state;
expect(state?.name, 'tulips');
expect(state?.fullPath, '/tulips');
expect(state.name, 'tulips');
expect(state.fullPath, '/tulips');
});

testWidgets('should allow route paths without leading /',
Expand Down