Let us say that I have a stream (A) that could either get : SuccessModel or the FailureModel.
Considering the above scenario, how should I go about it?
Should I just return an empty container and probably Future.delayed into the next page (upon success) or is there a method that I could use on my stream A so that I define a function or listener inside of my bloc class and it executes the right set of functions (routes) based upon the value that stream gets..
Any help would be appreciated!
So you have a stream
and you want your UI to redirect to the right Route
, depending on stream
's value.
If you're using a Router 1.0
, just listen
to stream
inside your widget and there decide whether to push
a route or not.
Or, if you're using a Router 2.0
, and maybe with GoRouter
you can listen to that stream directly in your ChangeNotifier
class, so that you redirect your user based on stream
's value.