flutterdata / flutter_data

Seamlessly manage persistent data in your Flutter apps
MIT License
410 stars 31 forks source link

Question: how to force repository synchronization when, say, FCM message received? #210

Closed andreystavitsky closed 1 year ago

andreystavitsky commented 1 year ago

I need some widgets to reflect changes immediately when FCM message received. Is there anything to trigger synchronization of repository?

FirebaseMessaging.onMessage.listen((RemoteMessage message) {
  print('Got a message whilst in the foreground!');
  // something to trigger repostory synchronization from remote
});
frank06 commented 1 year ago
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
  print('Got a message whilst in the foreground!');
  YourModel(text: message.test).save();
});

Please open these kind of questions in Discussions