I am building an app with flutter and firebase cloud messaging. In onLounch method I have some beahviuorSubjects which triggering redirects and data refresh. However they are not working because they fire before somebody listens. I do not want to use ReplaySubject because it is tricky so I wonder if there is some standard way how to golde them until app is ready?
p.s. i know that they do work because if i do some await Future.delay(Duration(seconds: 10))
all is working fine but this is not the way to go.
Okay I've found out how to wait for a certain screen.
Basically the onLaunch
method will be triggered once you make a call to your FirebaseMessaging.configure()
method. So, if you want your application to start with a loading screen and then go to a home screen after loading some data you simply need to call FirebaseMessaging.configure()
inside your home screen to fire the onLaunch
at that moment.