title: i have two blocs that must listen to each other, how do i pass one as a parameter to the other?
body: <p>**Hello I am new to flutter and bloc architecture.
  I am trying to build a simple quiz app that has a timer.
  On the quiz page, I have two blocs, a counter cubit to navigate to the next question, and a triviabloc for quiz activities like answer selection.</p>
  <p>I am using MultiBlovProvider to provide the blocs.</p>
  <p>I need each bloc to communicate with each other. Since each of the blocs is a parameter to the other, how do I pass it in the multiblocprovider
  ?**</p>
  <pre><code> var bloc = TriviaBloc();
                                      var con = CountDownController();
                                      // ignore: close_sinks
                                      var cubit = CounterCubit(
                                          bloc: bloc, controller: con);
                                      return MultiBlocProvider(
                                        providers: [
                                          BlocProvider&lt;TriviaBloc&gt;(
                                            create: (context) =&gt; bloc,
                                            
                                          ),
                                          BlocProvider&lt;CounterCubit&gt;(
                                              create: (context) =&gt; cubit)
                                        ],
                                        child:
                                            QuestionScreen(trivia: questions),
                                      );
  </code></pre>
  <p><strong>the cubit</strong></p>
  <pre><code>    class CounterCubit extends Cubit&lt;int&gt; {
    StreamSubscription sub;
    CounterCubit({this.controller, this.bloc}) : super(0) {
      sub = bloc.listen((state) {
        if (state is AnswerCorrect || state is AnswerNotCorrect) {
          controller.pause();
        }
      });
    }
    final TriviaBloc bloc;
  
    final CountDownController controller;
  
    void increment() =&gt; emit(state + 1);
  
    @override
    Future&lt;void&gt; close() {
      sub?.cancel();
      return super.close();
    }
  
    @override
    void onChange(Change&lt;int&gt; change) {
      print(change);
      super.onChange(change);
    }
  }
  </code></pre>
  <p><strong>the bloc that must listen to the cubit</strong></p>
  <pre><code>    class TriviaBloc extends Bloc&lt;TriviaEvent, TriviaState&gt; {
    StreamSubscription sub;
  
    TriviaBloc({this.cubit}) : super(TriviaInitial()) {
      sub = cubit.listen(
        (state) async* {
          if (state != 0) {
            yield TriviaInitial();
          }
        },
      );
    }
    final CounterCubit cubit;
  
    Stream&lt;TriviaState&gt; mapEventToState(TriviaEvent event) async* {
      if (event is AnswerCLicked) {
        print(event.answer);
        if (event.answer == event.correctAnswer) {
          yield AnswerCorrect();
        } else {
          yield AnswerNotCorrect();
        }
      }
  
      if (event is NoAnswerChosen) {
        yield ShowAnswer();
      }
    }
  
    @override
    Future&lt;void&gt; close() {
      sub?.cancel();
      return super.close();
    }
  }
  </code></pre>
  <p>Thank you</p>