title: how to test blocconsumer on flutter
body: <p>i want to ask about unit test widget on flutter. i have a screen that only listen on previous screen, the code :</p>
  
  <pre><code>return BlocConsumer&lt;MenuBloc, MenuState&gt;(
          listener: (context, state) {
        if (state is MyScreenLoaded) {
          Map&lt;String, dynamic&gt; messageShow = jsonDecode(state.message);
          var messageContent = messageShow['message'];
          state.statusCode != '200'
              ? _showAlert(state.statusCode, messageContent)
              : _checkCertificate(state.statusCode, messageContent);
        }
      }, builder: (context, state) {
  //return code here
  }
  
  </code></pre>
  
  <p>on _showAlert method void have some widget pop up, how to test it? i have do testing like this. but not working :</p>
  
  <pre><code>testWidgets('test existing trivia when state MyScreenloaded success', (WidgetTester tester) async{
      Map&lt;String, String&gt; testMessage = {'message': 'this is test'};
      when(menuBloc.state).thenAnswer((realInvocation) =&gt; MyScreenLoaded(message: '200', statusCode: testMessage.toString()));
  
      await tester.pumpWidget(BlocProvider.value(value: registerBloc, child: triviaScreen,));
      expect(find.byKey(MyScreenKeys.successTrivia), findsWidgets);
      expect(find.byKey(MyScreenKeys.imageSuccessTrivia), findsWidgets);
    });
  </code></pre>
  
  <p>thank you anyway...</p>