DEV Community


Discussion on: Flutter BLoC: Right way to Handle navigation

alexandreroba profile image
Alexandre Roba • Edited

Hi Pedro, I noticed something weird... if in the mapEventToState method you await for the navigator push methods, all following event push will simply be ignored...
Stream mapEventToState(NavigatorAction event) async* {
if(event is NavigatorActionPop){
}else if(event is NavigateToHomeEvent){
AWAIT navigatorKey.currentState.pushNamed('/home'); // This cause all following events to be ignored...

After some digging the navigatorKey.currentState.pushNamed() call never complete... You can add a then((_)=>print('completed')); this will never be called... We might have an issue somewhere here...

Any idea?


pedromassango profile image
Pedro Massango Author

Maybe it is not good idea to await since it will block all incoming events. I've never tried await there before. Let me investigate...