Skip to content

Instantly share code, notes, and snippets.

@pedromassango
Created July 21, 2019 00:37
Show Gist options
  • Select an option

  • Save pedromassango/d35a233722b866f2c64b3a7f58b1b3fc to your computer and use it in GitHub Desktop.

Select an option

Save pedromassango/d35a233722b866f2c64b3a7f58b1b3fc to your computer and use it in GitHub Desktop.
class NavigatorBloc extends Bloc<NavigatorAction, dynamic>{
final GlobalKey<NavigatorState> navigatorKey;
NavigatorBloc({this.navigatorKey});
@override
dynamic get initialState => 0;
@override
Stream<dynamic> mapEventToState(NavigatorAction event) async* {
if(event is NavigatorActionPop){
navigatorKey.currentState.pop();
}else if(event is NavigateToHomeEvent){
navigatorKey.currentState.pushNamed('/home');
}
}
}
@Allan-Nava

Copy link
Copy Markdown

Have you got a full example of project=?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment