Skip to content

Commit f27d3c9

Browse files
authored
[go_router]Updates documentations around GoRouter.of, GoRouter.maybeOf, and BuildContext extension. (flutter#4176)
fixes flutter#121506
1 parent fa2e8a0 commit f27d3c9

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

packages/go_router/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 8.0.4
2+
3+
- Updates documentations around `GoRouter.of`, `GoRouter.maybeOf`, and `BuildContext` extension.
4+
5+
16
## 8.0.3
27

38
- Makes namedLocation and route name related APIs case sensitive.

packages/go_router/lib/src/misc/extensions.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import '../router.dart';
1010
/// context.go('/');
1111
extension GoRouterHelper on BuildContext {
1212
/// Get a location from route name and parameters.
13+
///
14+
/// This method can't be called during redirects.
1315
String namedLocation(
1416
String name, {
1517
Map<String, String> pathParameters = const <String, String>{},

packages/go_router/lib/src/router.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ class GoRouter extends ChangeNotifier implements RouterConfig<RouteMatchList> {
466466
}
467467

468468
/// Find the current GoRouter in the widget tree.
469+
///
470+
/// This method throws when it is called during redirects.
469471
static GoRouter of(BuildContext context) {
470472
final InheritedGoRouter? inherited =
471473
context.dependOnInheritedWidgetOfExactType<InheritedGoRouter>();
@@ -474,6 +476,8 @@ class GoRouter extends ChangeNotifier implements RouterConfig<RouteMatchList> {
474476
}
475477

476478
/// The current GoRouter in the widget tree, if any.
479+
///
480+
/// This method returns null when it is called during redirects.
477481
static GoRouter? maybeOf(BuildContext context) {
478482
final InheritedGoRouter? inherited =
479483
context.dependOnInheritedWidgetOfExactType<InheritedGoRouter>();

packages/go_router/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: go_router
22
description: A declarative router for Flutter based on Navigation 2 supporting
33
deep linking, data-driven routes and more
4-
version: 8.0.3
4+
version: 8.0.4
55
repository: https://github.com/flutter/packages/tree/main/packages/go_router
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22
77

0 commit comments

Comments
 (0)