DEV Community

Discussion on: Flutter BLoC: Right way to Handle navigation

Collapse
 
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...
@override
Stream mapEventToState(NavigatorAction event) async* {
if(event is NavigatorActionPop){
navigatorKey.currentState.pop();
}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?

Alex

Collapse
 
pedromassango profile image
Pedro Massango

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...