forGoRouter static method
GoRouterPageBuilder
forGoRouter(
- Widget child(
- BuildContext context,
- GoRouterState state
- bool fullscreenDialog = false,
Implementation
static GoRouterPageBuilder forGoRouter(
Widget Function(BuildContext context, GoRouterState state) child, {
bool fullscreenDialog = false,
}) {
return (BuildContext context, GoRouterState state) {
final extra = state.extra;
final eventProps = <String, dynamic>{};
try {
final props = jsonDecode(state.uri.queryParameters['eventProps'] ?? '');
eventProps.addAll(props);
} catch (e) {
// ignore
}
if (extra is Map) {
return _getPage(
child: child(context, state),
eventProps: {
...(extra['eventProps'] ?? {}),
...eventProps,
},
state: state,
fullscreenDialog: fullscreenDialog);
}
return _getPage(
child: child(context, state),
eventProps: eventProps,
state: state,
fullscreenDialog: fullscreenDialog,
);
};
}