i am launching a specific route in flutter using Intent like below
class NotificationService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {
if(remoteMessage.data.isNotEmpty()) {
val intent = Intent(this, MainActivity::class.java)
intent.putExtra("route","/specific_route_name");
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent);
}
}
}
and my onGenerated function is responsible to handle and launch that flutter screen like below
static Route<dynamic> generateRoute(RouteSettings settings) {
switch (settings.name) {
case '/':
return CupertinoPageRoute(builder: (_) => MyHomePage());
case '/specific_route_name':
return CupertinoPageRoute(builder: (_) => SpecificPage());
default:
return CupertinoPageRoute(
builder: (_) => Scaffold(
body: Center(
child: Text('No route defined for ${settings.name}'),
),
),
);
}
}
now how can i pass data too? via that intent i tried intent.putExtra("data") & intent.putExtra("argument") (just tried my dumb luck)