title: Flutter bloc listener not listening to state changes
body: <p>I am using flutter_bloc library to create a verification code page. Here is what I tried to do.</p>
  <pre><code>class PhonePage extends StatelessWidget {
    static Route route() {
      return MaterialPageRoute&lt;void&gt;(builder: (_) =&gt; PhonePage());
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: BlocProvider(
          create: (_) =&gt;
              ValidationCubit(context.repository&lt;AuthenticationRepository&gt;()),
          child: PhoneForm(),
        ),
      );
    }
  }
  
  class PhoneForm extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return BlocConsumer&lt;ValidationCubit, ValidationState&gt;(
        listener: (context, state) {
          print('Listener has been called');
          if (state.status.isSubmissionFailure) {
            _showVerificationError(context);
          } else if (state.status.isSubmissionSuccess) {
            _showVerificationSuccess(context);
          }
        },
        builder: (context, state) {
          return Container(
            child: SingleChildScrollView(
              child: Padding(
                padding: EdgeInsets.all(16.0),
                child: Column(
                  mainAxisSize: MainAxisSize.max,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    _HeaderAndTitle(),
                    _VerificationInput(),
                    _VerifyButton()
                  ],
                ),
              ),
            ),
          );
        },
      );
    }
  
    void _showVerificationError(context) {
      Scaffold.of(context)
        ..hideCurrentSnackBar()
        ..showSnackBar(const SnackBar(content: Text('Validation error')));
    }
  
    void _showVerificationSuccess(context) {
      Scaffold.of(context)
        ..hideCurrentSnackBar()
        ..showSnackBar(const SnackBar(
          content: Text('Validation Success'),
          backgroundColor: Colors.green,
        ));
    }
  }
  
  ...
  
  class _VerifyButton extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return BlocBuilder&lt;ValidationCubit, ValidationState&gt;(
          builder: (context, state) {
        return RaisedButton.icon(
            color: Colors.blue,
            padding: EdgeInsets.symmetric(horizontal: 38.0, vertical: 12.0),
            textColor: Colors.white,
            icon: state.status.isSubmissionInProgress
                ? Icon(FontAwesomeIcons.ellipsisH)
                : Icon(null),
            label: Text(state.status.isSubmissionInProgress ? '' : 'Verify',
                style: TextStyle(fontSize: 16.0)),
            shape:
                RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
            onPressed: state.status.isValid
                ? () =&gt; context.bloc&lt;ValidationCubit&gt;().verifyCode()
                : null);
      });
    }
  }
  </code></pre>
  <p>Now the verifyCode() function is an async function defined inside ValidationCubit. It emits states with status set to loading, success and failure. However the listener doesn't pick up those changes and show the snackbars. I couldn't figure why? I am also using the Formz library as suggested in the flutter_bloc documentation. Here is the verifyCode part.</p>
  <pre><code>Future&lt;void&gt; verifyCode() async {
      if (!state.status.isValidated) return;
      emit(state.copyWith(status: FormzStatus.submissionInProgress));
      try {
        // send validation code to server here
        await _authenticationRepository.loginWithEmailAndPassword(
            email: 'email@email.com', password: '12');
        emit(state.copyWith(status: FormzStatus.submissionSuccess));
      } on Exception {
        emit(state.copyWith(status: FormzStatus.submissionFailure));
      }
    }
  </code></pre>
  <p>The verification code model looks like this:</p>
  <pre><code>class ValidationState extends Equatable {
    final VerificationCode verificationCode;
    final FormzStatus status;
  
    const ValidationState({this.verificationCode, this.status});
  
    @override
    List&lt;Object&gt; get props =&gt; [verificationCode];
  
    ValidationState copyWith(
        {VerificationCode verificationCode, FormzStatus status}) {
      return ValidationState(
          verificationCode: verificationCode ?? this.verificationCode,
          status: status ?? this.status);
    }
  }
  </code></pre>
  <p>And the validation state class is:</p>
  <pre><code>class ValidationState extends Equatable {
    final VerificationCode verificationCode;
    final FormzStatus status;
  
    const ValidationState({this.verificationCode, this.status});
  
    @override
    List&lt;Object&gt; get props =&gt; [verificationCode];
  
    ValidationState copyWith(
        {VerificationCode verificationCode, FormzStatus status}) {
      return ValidationState(
          verificationCode: verificationCode ?? this.verificationCode,
          status: status ?? this.status);
    }
  }
  </code></pre>