Skip to content

Commit

Permalink
format and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
chunhtai committed Nov 2, 2022
1 parent 6a3251b commit 938f715
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/go_router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT
## 5.1.2

- Update README
- Allows redirection to return same location.
- Updates README.
- Removes dynamic calls in examples.

## 5.1.1
Expand Down
3 changes: 2 additions & 1 deletion packages/go_router/lib/src/redirection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ FutureOr<RouteMatchList> redirect(
}
FutureOr<RouteMatchList> processRouteLevelRedirect(
String? routeRedirectLocation) {
if (routeRedirectLocation != null && routeRedirectLocation != prevLocation) {
if (routeRedirectLocation != null &&
routeRedirectLocation != prevLocation) {
final RouteMatchList newMatch = _getNewMatches(
routeRedirectLocation,
prevMatchList.location,
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: 5.1.1
version: 5.1.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
13 changes: 7 additions & 6 deletions packages/go_router/test/go_router_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1158,28 +1158,29 @@ void main() {
expect(redirected, isTrue);
});

testWidgets('redirect can redirect to same path', (WidgetTester tester) async {
testWidgets('redirect can redirect to same path',
(WidgetTester tester) async {
final List<GoRoute> routes = <GoRoute>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) =>
const HomeScreen(),
const HomeScreen(),
routes: <GoRoute>[
GoRoute(
path: 'dummy',
// Return same location.
redirect: (_, GoRouterState state) => state.location,
builder: (BuildContext context, GoRouterState state) =>
const DummyScreen()),
const DummyScreen()),
],
),
];

final GoRouter router = await createRouter(routes, tester,
redirect: (BuildContext context, GoRouterState state) {
// Return same location.
return state.location;
});
// Return same location.
return state.location;
});

expect(router.location, '/');
// Directly set the url through platform message.
Expand Down

0 comments on commit 938f715

Please sign in to comment.