-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#7278Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listd: examplesSample code and demosSample code and demosp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
All of the examples in the documentation for the redirect field on the GoRouter class now use the incorrect signature.
One such example from the docs:
final GoRouter _router = GoRouter(
routes: <GoRoute>[
GoRoute(
path: '/',
redirect: (_) => '/family/${Families.data[0].id}',
),
GoRoute(
path: '/family',
pageBuilder: (BuildContext context, GoRouterState state) => ...,
),
GoRoute(
path: '/:username',
pageBuilder: (BuildContext context, GoRouterState state) => ...,
),
],
);The GoRouterRedirect callback now takes a BuildContext in addition to the GoRouterState that was there before.
For the examples to compile, we would need to change the constructor parameter to something like:
redirect: (_, __) => '/family/${Families.data[0].id}',Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listd: examplesSample code and demosSample code and demosp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.