From 8d3fc615b2b423dc941be372f15cee6823cf99ba Mon Sep 17 00:00:00 2001 From: Adrien Bonnin <adbonnin@ippon.fr> Date: Wed, 21 Sep 2022 16:50:00 +0200 Subject: [PATCH] :sparkles: Redirection en cas d'une erreur de routing --- lib/app.dart | 1 + pubspec.lock | 35 ++++++++++++++--------------------- pubspec.yaml | 2 +- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index ccdef33..68d3412 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -32,6 +32,7 @@ class App extends StatelessWidget { static GoRouter buildRouter(List<ExampleGroup> groups) { return GoRouter( + redirect: (context, state) => state.location == '' ? groups[0].path : null, navigatorKey: _rootNavigatorKey, initialLocation: groups[0].path, routes: [ diff --git a/pubspec.lock b/pubspec.lock index 8a2c7d7..89a1b01 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -105,14 +105,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" checked_yaml: dependency: transitive description: @@ -133,7 +126,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" code_builder: dependency: transitive description: @@ -182,7 +175,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" file: dependency: transitive description: @@ -253,7 +246,7 @@ packages: name: go_router url: "https://pub.dartlang.org" source: hosted - version: "4.5.0" + version: "5.0.0" graphs: dependency: transitive description: @@ -323,21 +316,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" mime: dependency: transitive description: @@ -365,7 +358,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" petitparser: dependency: transitive description: @@ -433,7 +426,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -468,21 +461,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" timing: dependency: transitive description: @@ -534,4 +527,4 @@ packages: version: "3.1.1" sdks: dart: ">=2.17.1 <3.0.0" - flutter: ">=3.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0d99536..8c9d23f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,7 +35,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 flutter_riverpod: ^2.0.0-dev.9 - go_router: ^4.5.0 + go_router: ^5.0.0 dev_dependencies: flutter_test: -- GitLab