title: flutter Bloc pattern -- how to access bloc data after navigator
body: <p>I have an app with 2 pages, when tab on Home page button it navigates to Settings page.</p>
  
  <pre><code>IconButton( 
      onPressed:(){ 
          Navigator.push(
              context, 
              MaterialPageRoute( builder: (context) =&gt; Settings())
          );
      },
  ),
  </code></pre>
  
  <p>But on settings page, stream data from my bloc are all NULL. I have no idea why, on home page is all good. </p>
  
  <p>I added new data into the Bloc in Settings page as a test, it shows up fine, so the Bloc implementation is working fine, just not getting the initiated data in the bloc constructor.</p>
  
  <p>what did I do wrong? </p>
  
  <p>Bloc data are initiated inside the bloc constructor, here is my Bloc code</p>
  
  <pre><code>class StateBloc implements BlocBase {
  
    var selectedCurrencies;
  
    StreamController&lt;List&gt; _selectedCurrencies = StreamController&lt;List&gt;.broadcast();
    Stream&lt;List&gt; get getSelectedCurrencies =&gt; _selectedCurrencies.stream;
    StreamSink get modifySelectedCurrencies =&gt; _selectedCurrencies.sink;
  
     StateBloc() {
        selectedCurrencies = ['cny','aud','usd'];
        modifySelectedCurrencies.add(selectedCurrencies);
    }
  }
  </code></pre>
  
  <p>Here is how bloc is provided to main.dart</p>
  
  <pre><code>Future&lt;void&gt; main() async{
    return runApp(
      BlocProvider&lt;StateBloc&gt;(
          child: MyApp(),
          bloc: StateBloc(),
      ),
    );
  }
  
  class MyApp extends StatelessWidget {
    // This widget is the root of your application.
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Exchange',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(fontFamily: 'Poppins'),
        home: MyHomePage(),
      );
    }
  }
  </code></pre>
  
  <p>Here is my Settings page </p>
  
  <pre><code>class Settings extends StatelessWidget {
  
    @override
    Widget build(BuildContext context) {
  
      final StateBloc appBloc = BlocProvider.of&lt;StateBloc&gt;(context);
      return MaterialApp(
        home: Scaffold(
          body: ListView(
            children: &lt;Widget&gt;[
              StreamBuilder(
                stream: appBloc.getSelectedCurrencies,
                builder: (context, selectedCurrenciesSnap) {
                    print('alllll --&gt; ${allCurrenciesSnap.data}');
                }
              )
             ]
           )
         )
        )
     }
   }
  </code></pre>