0
Guys, I’m trying to push Notifications to my application users in Flutter, however when I do the method
void initState() {
\\\\\
}
and configure the entire notification system, the compiler returns me an error of: This method overrides a method annotated as @mustCallSuper in 'State', but does not invoke the overridden method.
I’m not understanding the cause of the error, the notification configuration process is correct, follow the complete code here:
class _MyHomePageState extends State<MyHomePage> {
String textValue = 'Hello World';
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
@override
void initState() {
firebaseMessaging.configure(
onLaunch: (Map<String, dynamic> msg){
print(" onLaunch called");
},
onResume: (Map<String, dynamic> msg){
print(" onResume called");
},
onMessage: (Map<String, dynamic> msg){
print(" onMessage called");
}
);
firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(
sound: true,
alert: true,
badge: true
)
);
firebaseMessaging.onIosSettingsRegistered.listen((IosNotificationSettings setting){
print('IOS Setting Registed');
});
firebaseMessaging.getToken().then((token){
update(token);
});
}
update(String token){
print(token);
textValue = token;
setState((){
});
}
}