title: Flutter BloC boolean updating state
body: <p>I'd like to realize a welcome screen for my application that is capable to change from Login to Register, with different forms and buttons, without changing some widgets on the screen (like the background for example).
  I've tried to use the same scaffold with a stack, all sorrounded by a BlocProvider. The welcomeBloc should be responsible for the change of forms between login and register form. The loginBloc and registerBloc should be responsible for managing the state and inputs in the two forms.
  The user repository is for operations like the login with google and so on.</p>
  
  <pre><code>class WelcomeScreen extends StatefulWidget {
    @override
    _WelcomeScreenState createState() =&gt; _WelcomeScreenState();
  }
  
  class _WelcomeScreenState extends State&lt;WelcomeScreen&gt; {
    LoginBloc _loginBloc;
    RegisterBloc _registerBloc;
    WelcomeBloc _welcomeBloc;
    UserRepository _userRepository = UserRepository();
  
    @override
    void initState() {
      _loginBloc = LoginBloc(userRepository: _userRepository);
      _registerBloc = RegisterBloc(userRepository: _userRepository);
      _welcomeBloc = WelcomeBloc();
      super.initState();
    }
  
    @override
    Widget build(BuildContext context) {
      return BlocProvider(
        bloc: _welcomeBloc,
        child: Scaffold(
          backgroundColor: Colors.black,
          resizeToAvoidBottomPadding: false,
          body: Stack(
            children: &lt;Widget&gt;[
              Opacity(opacity: 0.6, child: Background()),
              Padding(
                padding: const EdgeInsets.only(top: 130, left: 20),
                child: Text(
                  "Welcome.",
                  style: welcomeStyleBig,
                ),
              ),
              _welcomeBloc.getLogin
                  ? BlocProvider(
                      bloc: _loginBloc,
                      child: LoginForm(
                        userRepository: _userRepository,
                      ),
                    )
                  : BlocProvider(
                      bloc: _registerBloc,
                      child: RegisterForm(),
                    ),
            ],
          ),
        ),
      );
    }
  }
  
  </code></pre>
  
  <p>I've tried to implement the changing of form by using a boolean variable _isLogin in the WelcomeBloc but when I tap on the button responsible for the update, nothing appens until I hot reload the app. Maybe I didn't understand bloc pattern very well.</p>
  
  <p>Here are my welcome bloc files.</p>
  
  <p>welcome_bloc.dart</p>
  
  <pre><code>class WelcomeBloc extends Bloc&lt;WelcomeEvent, WelcomeState&gt; {
    @override
    WelcomeState get initialState =&gt; InitialWelcomeState();
  
    bool _isLogin = true;
  
    bool get getLogin =&gt; _isLogin;
  
    @override
    Stream&lt;WelcomeState&gt; mapEventToState(
      WelcomeEvent event,
    ) async* {
      if (event is SwitchToLogin) {
        _isLogin = true;
        yield WelcomeLogin();
      }
      if (event is SwitchToRegister) {
        _isLogin = false;
        yield WelcomeRegister();
      }
    }
  }
  </code></pre>
  
  <p>welcome_event.dart</p>
  
  <pre><code>abstract class WelcomeEvent extends Equatable {
    WelcomeEvent([List props = const []]) : super(props);
  }
  
  class SwitchToLogin extends WelcomeEvent {
    @override
    String toString() {
      return "Switch to Login";
    }
  }
  
  class SwitchToRegister extends WelcomeEvent {
    @override
    String toString() {
      return "Switch to Register";
    }
  }
  </code></pre>
  
  <p>welcome_state.dart</p>
  
  <pre><code>abstract class WelcomeState extends Equatable {
    WelcomeState([List props = const []]) : super(props);
  }
  
  class InitialWelcomeState extends WelcomeState {
    @override
    List&lt;Object&gt; get props =&gt; [];
  }
  
  class WelcomeLogin extends WelcomeState {
    @override
    String toString() =&gt; 'Welcome Login';
  }
  
  class WelcomeRegister extends WelcomeState {
    @override
    String toString() =&gt; 'Welcome Register';
  }
  </code></pre>