//Inside main.dart
return MaterialApp(
initialRoute: WelcomeScreen.id,
routes: {
WelcomeScreen.id: (context) => WelcomeScreen(),
LoginScreen.id: (context) => LoginScreen(),
RegistrationScreen.id: (context) => RegistrationScreen(),
ChatScreen.id: (context) => ChatScreen(),
},
);
//Inside **** Class:
static const String id = '****';
//Inside onPressed
onTap: () => Navigator.pushNamed(context, VideoScreen.id, arguments: {
'chapter_name': 'Chapter $index',
}),
// In receiving side
final Map<String, String> received = ModalRoute.of(context).settings.arguments;
final chapterName = received['chapter_name'];
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter