@@ -63,7 +63,7 @@ class Bookstore extends StatelessWidget {
63
63
GoRoute (
64
64
path: '/book/:bookId' ,
65
65
redirect: (BuildContext context, GoRouterState state) =>
66
- '/books/all/${state .params ['bookId' ]}' ,
66
+ '/books/all/${state .pathParameters ['bookId' ]}' ,
67
67
),
68
68
GoRoute (
69
69
path: '/books/:kind(new|all|popular)' ,
@@ -72,14 +72,14 @@ class Bookstore extends StatelessWidget {
72
72
key: _scaffoldKey,
73
73
child: BookstoreScaffold (
74
74
selectedTab: ScaffoldTab .books,
75
- child: BooksScreen (state.params ['kind' ]! ),
75
+ child: BooksScreen (state.pathParameters ['kind' ]! ),
76
76
),
77
77
),
78
78
routes: < GoRoute > [
79
79
GoRoute (
80
80
path: ':bookId' ,
81
81
builder: (BuildContext context, GoRouterState state) {
82
- final String bookId = state.params ['bookId' ]! ;
82
+ final String bookId = state.pathParameters ['bookId' ]! ;
83
83
final Book ? selectedBook = libraryInstance.allBooks
84
84
.firstWhereOrNull ((Book b) => b.id.toString () == bookId);
85
85
@@ -91,7 +91,7 @@ class Bookstore extends StatelessWidget {
91
91
GoRoute (
92
92
path: '/author/:authorId' ,
93
93
redirect: (BuildContext context, GoRouterState state) =>
94
- '/authors/${state .params ['authorId' ]}' ,
94
+ '/authors/${state .pathParameters ['authorId' ]}' ,
95
95
),
96
96
GoRoute (
97
97
path: '/authors' ,
@@ -107,7 +107,7 @@ class Bookstore extends StatelessWidget {
107
107
GoRoute (
108
108
path: ':authorId' ,
109
109
builder: (BuildContext context, GoRouterState state) {
110
- final int authorId = int .parse (state.params ['authorId' ]! );
110
+ final int authorId = int .parse (state.pathParameters ['authorId' ]! );
111
111
final Author ? selectedAuthor = libraryInstance.allAuthors
112
112
.firstWhereOrNull ((Author a) => a.id == authorId);
113
113
@@ -135,7 +135,7 @@ class Bookstore extends StatelessWidget {
135
135
136
136
String ? _guard (BuildContext context, GoRouterState state) {
137
137
final bool signedIn = _auth.signedIn;
138
- final bool signingIn = state.subloc == '/signin' ;
138
+ final bool signingIn = state.matchedLocation == '/signin' ;
139
139
140
140
// Go to /signin if the user is not signed in
141
141
if (! signedIn && ! signingIn) {
0 commit comments