title: Flutter Bloc for navigation flow
body: <p>I am getting started with the BLoC pattern but I have a question:</p>
  
  <p>1) Should you use the BloC pattern to determine if the routes should change?
  Example: authentication object changes to <code>unauthenticated</code> so the listeners should handle the route changes.</p>
  
  <p>2) Should the BLoC pattern only be used for UI state and handle the route changes on UI changes?
  Example: User clicks on <code>login</code> and navigates to the <code>home</code> screen.</p>
  
  <p>I ask this question because I'm facing a problem where I don't have a central navigation management solution.</p>
  
  <p>This code is in my BLoC now:</p>
  
  <pre><code>loggedIn.listen((AuthResponse user) {
        currentUserSubject.add(user);
        Navigator.pushReplacement(
          _context,
          PageRouteBuilder(
            pageBuilder: (context, animation1, animation2) {
              return HomePage();
            },
            transitionsBuilder: (context, animation, _, child) {
              return new SlideTransition(
                child: child,
                position: new Tween&lt;Offset&gt;(
                  begin: const Offset(0.0, 1.0),
                  end: Offset.zero,
                ).animate(animation),
              );
            },
            transitionDuration: Duration(milliseconds: 400),
          ),
        );
      }, onError: (error) {
        Scaffold.of(_context).showSnackBar(new SnackBar(
          content: new Text(error.message),
        ));
      });
  </code></pre>