我正在使用Firebase推送通知的Flutter应用程序中工作。我有一个问题,就是onMessage我从Firebase接收数据,但问题是唯一的打印数据工作正常,但无法导航到其他屏幕。
_configureFirebaseMessageing() {
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print('\n\n\n message from fcm \n $message\n\n\n\n');
Navigator.pushNamed(context, Routes.FirstProfile);
},
onLaunch: (Map<String, dynamic> message) async {
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return NativationPage("this is from main ON Resume ${message['data']['title']}");
}));
},
onResume: (Map<String, dynamic> message) async {
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return NativationPage("this is from main ON Resume ${message['data']['title']}");
}));
},
);
}
这是我的代码,是的,仅在控制台上的打印数据有效,并且在其他三个onMessage,onLaunch和onResume上的导航都无法正常工作。
我在控制台中出错:
E/FlutterFcmService( 2445): Fatal: failed to find callback
第二个错误是
w/firebasemessaging( 2445): missing default notification channel metadata in android manifest. default value will be used.