title: Connecting a sink of BLoC with another BLoC
body: <p>I am using the BLoC pattern as described at <a href="https://medium.com/flutter-io/build-reactive-mobile-apps-in-flutter-companion-article-13950959e381" rel="nofollow noreferrer">the Google IO talk</a>.</p>
  
  <p>I have a simple BLoC which is used to display a alert in the UI whenever a string is added to <code>messageSink</code>:</p>
  
  <pre><code>class AlertBloc {
    final _message = BehaviorSubject&lt;String&gt;();
  
    AlertBloc() {}
  
    Stream&lt;String&gt; get message =&gt; _message.stream;
  
    Sink&lt;String&gt; get messageSink =&gt; _message.sink;
  
    void dispose() {
      _message.close();   }
  }
  </code></pre>
  
  <p>Elsewhere in the app, I have another BLoC which needs to add a string to <code>messageSink</code>, when a certain condition is met.</p>
  
  <p>I noticed it is not a good idea to provide the whole BLoC from the <a href="https://github.com/filiph/state_experiments/blob/master/shared/lib/src/bloc_complex/product_grid/product_square_bloc.dart" rel="nofollow noreferrer">Google I/O repo for the talk</a>, and they provide advice for connecting a <strong>stream</strong> from a BLoC to another BLoC <strong>sink</strong>:</p>
  
  <blockquote>
    <p>Note that we are <em>not</em> providing [CartBloc] to the
    [ProductSquareBloc] directly, although it would be easier to
    implement. BLoCs should not depend on other BLoCs (separation of
    concerns). They can only communicate with each other using
    streams. In this case, the [CartBloc.items] output plugs into the
    [ProductSquareBloc.cartItems] input.</p>
  </blockquote>
  
  <p>My question is how to connect a <strong>sink</strong> from a BLoC to another BLoC <strong>stream</strong>?</p>