Skip to content

Instantly share code, notes, and snippets.

@daiki1003
Last active May 5, 2022 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daiki1003/1d10c32d4c1560c9c971c2f700b9069a to your computer and use it in GitHub Desktop.
Save daiki1003/1d10c32d4c1560c9c971c2f700b9069a to your computer and use it in GitHub Desktop.
// some_screen.dart
class SomeScreen extends StatelessWidget {
static GoRoute route({
List<GoRoute> routes = const <GoRoute>[],
}) {
return GoRoute(
path: routeName,
name: routeName,
builder: (_, __) => const SomeScreen(),
routes: routes,
);
}
static const routeName = 'some_screen';
@override
Widget build(BuildContext context) {
return ...
}
}
// router.dart
GoRouter(
debugLogDiagnostics: kDebugMode,
routes: [
SomeScreen.route(
routes: HogeScreen.route(),
),
],
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment