I'm trying to implement local notifications but I'm facing the NoSuchMethodError, I have debugged the code and find the issue but didn't find the correct solution for it. I have created the notification manager class I'm calling it like this in AddNotification.dart Stateful class
final NotificationManager manager;
const AddNotification(this.manager);
then call it like this in its State class:
widget.manager.showNotificationDaily(1, "Asar", "isNotification", hour, minute);
and in the previous class from where AddNotification is called is I have sent a Notification manager object like this.
class AllSurah extends StatefulWidget {
NotificationManager manager;
@override
_AllSurahState createState() => _AllSurahState();
}
Navigator.push(
context,
MaterialPageRoute(builder: (context) => AddNotification(widget.manager)),
);
I have debugged the code and find that the manager is passing null from the previous class from where the NotificationManger object is passed. How can I solve this issue?
Just try the below code:
NotificationManager manager = new NotificationManager();