配置方法无法运行。
class MainMenuState extends State<MainMenuPage> {
final FirebaseMessaging _messaging = FirebaseMessaging();
int counter = 1;
@override
void initState() {
super.initState();
_messaging.getToken().then((token){
print(token);
});
_messaging.configure(
onMessage: (Map<String, dynamic> message) async {
print("A notification was received. But this onMessage won't run when app is in background.");
postCall(message['notification']['title'], message['notification']['body']);
},
onResume: (Map<String, dynamic> message) async {
print("onResume will run when a notification is pressed, resuming an app in background.");
postCall(message['data']['title'], message['data']['body']);
},
onLaunch: (Map<String, dynamic> message) async {
print('on launch $message');
}
);
}