From 938f71546033685b0ec6c5c2fc2d644c263634cb Mon Sep 17 00:00:00 2001 From: Chun-Heng Tai Date: Wed, 2 Nov 2022 16:12:34 -0700 Subject: [PATCH] format and bump version --- packages/go_router/CHANGELOG.md | 5 +++-- packages/go_router/lib/src/redirection.dart | 3 ++- packages/go_router/pubspec.yaml | 2 +- packages/go_router/test/go_router_test.dart | 13 +++++++------ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md index 4d326cd2dab8..d197511cc0ee 100644 --- a/packages/go_router/CHANGELOG.md +++ b/packages/go_router/CHANGELOG.md @@ -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 diff --git a/packages/go_router/lib/src/redirection.dart b/packages/go_router/lib/src/redirection.dart index 7f00895b1f34..996aa346083d 100644 --- a/packages/go_router/lib/src/redirection.dart +++ b/packages/go_router/lib/src/redirection.dart @@ -63,7 +63,8 @@ FutureOr redirect( } FutureOr processRouteLevelRedirect( String? routeRedirectLocation) { - if (routeRedirectLocation != null && routeRedirectLocation != prevLocation) { + if (routeRedirectLocation != null && + routeRedirectLocation != prevLocation) { final RouteMatchList newMatch = _getNewMatches( routeRedirectLocation, prevMatchList.location, diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml index f2c47050bf40..c3151361c9f3 100644 --- a/packages/go_router/pubspec.yaml +++ b/packages/go_router/pubspec.yaml @@ -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 diff --git a/packages/go_router/test/go_router_test.dart b/packages/go_router/test/go_router_test.dart index 61e028ca6c68..90c0ae24bac2 100644 --- a/packages/go_router/test/go_router_test.dart +++ b/packages/go_router/test/go_router_test.dart @@ -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 routes = [ GoRoute( path: '/', builder: (BuildContext context, GoRouterState state) => - const HomeScreen(), + const HomeScreen(), routes: [ 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.