Skip to content

Commit 8a14664

Browse files
committed
Handle /:gistId route
Resolves #3088
1 parent f1f0748 commit 8a14664

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: pkgs/dartpad_ui/lib/main.dart

+6-4
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ class _DartPadAppState extends State<DartPadApp> {
6060
builder: _homePageBuilder,
6161
),
6262
GoRoute(
63-
path: '/flutter',
64-
builder: _homePageBuilder,
63+
path: '/:gistId',
64+
builder: (context, state) => _homePageBuilder(context, state,
65+
gist: state.pathParameters['gistId']),
6566
),
6667
],
6768
);
@@ -116,9 +117,10 @@ class _DartPadAppState extends State<DartPadApp> {
116117
});
117118
}
118119

119-
Widget _homePageBuilder(BuildContext context, GoRouterState state) {
120+
Widget _homePageBuilder(BuildContext context, GoRouterState state,
121+
{String? gist}) {
120122
final path = state.path;
121-
final gistId = state.uri.queryParameters['id'];
123+
final gistId = gist ?? state.uri.queryParameters['id'];
122124
final builtinSampleId = state.uri.queryParameters['sample'];
123125
final flutterSampleId = state.uri.queryParameters['sample_id'];
124126
final channelParam = state.uri.queryParameters['channel'];

0 commit comments

Comments
 (0)