Last active
May 5, 2022 14:55
-
-
Save daiki1003/1d10c32d4c1560c9c971c2f700b9069a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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