import 'package:awesome_notifications/awesome_notifications.dart'; import 'package:didvan/services/app_home_widget/home_widget_repository.dart'; import '../../../models/notification_message.dart'; class NotificationController { /// Use this method to detect when a new notification or a schedule is created @pragma("vm:entry-point") static Future onNotificationCreatedMethod( ReceivedNotification receivedNotification) async { // Your code goes here } /// Use this method to detect every time that a new notification is displayed @pragma("vm:entry-point") static Future onNotificationDisplayedMethod( ReceivedNotification receivedNotification) async { // Your code goes here } /// Use this method to detect if the user dismissed a notification @pragma("vm:entry-point") static Future onDismissActionReceivedMethod( ReceivedAction receivedAction) async { // Your code goes here } /// Use this method to detect when the user taps on a notification or action button @pragma("vm:entry-point") static Future onActionReceivedMethod( ReceivedAction receivedAction) async { NotificationMessage data = NotificationMessage.fromJson(receivedAction.payload!); // Your code goes here HomeWidgetRepository.data = data; await HomeWidgetRepository.decideWhereToGoNotif(); return; // MyApp.navigatorKey.currentState?.pushNamedAndRemoveUntil('/notification-page', // (route) => (route.settings.name != '/notification-page') || route.isFirst, // arguments: receivedAction); } }