0

I have setup background notifications , Hive (To store Notification Locally Using Adapter Class) and Setup a ChangeNotifier ModelClass to get Updates in UI.

Problem: I want to Add Notification data In Hive With ModelClass to get Notified in UI ,If Application is Not Active.

Now I need to access Provider.of(context) in my backgroundHandler which must be a static method where there is no context.

All I need to do is to perform an action according to the data in the background notification.

Same As In this Post

  • you can use `context` in `didChangeDependencies()` in StatefulWidget you can also pass the context in argument from build method when you calling the function – Akshay Nayka Mar 03 '21 at 05:23
  • I want to get Notified When ITEM gets Added In the Hive Box. Like This: await Provider.of(context, listen: false).addItem(item); Inside FCM BackgroundMessage Handler. It's Only Getting Updates On UI ,When I Completly detached the Application and Run Again. Then Only Hive Box is Showing Updates. @AkshayNayka – adarsh raj Mar 03 '21 at 05:28
  • @adarshraj did you find any solution? – Bilal Rabbi May 26 '21 at 17:39

0 Answers0