title: Bloc stream not updating properly
body: <p>This is a direct follow on from:   <a href="https://stackoverflow.com/questions/55988714/bloc-architecture-the-getter-x-was-called-on-null">Bloc architecture &quot;the getter x was called on null.&quot;</a>  which was resolved by @nonybrighto</p>
  
  <p>The issue now is that although I am getting no error from the application any more, the logic is failing somewhere as the colours are not updating, they just remain blue.  If I call: colorBloc.changeColor(); from either a callback to the child (dropdownmenu) itself, or directly from the parent, it just doesn't actually update the colours of these widget buttons.   They are always blue.</p>
  
  <p>Is there something additional I have to do to get my button widgets to actually update?</p>
  
  <p>Is any additional information required?</p>
  
  <p>Edit:   The parent and child classes, and how I am trying to use the bloc.</p>
  
  <blockquote>
    <p>dropdownmenu.dart</p>
  </blockquote>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'dart:math';
  import 'package:ultimate_mtg/model/colorBloc.dart';
  import 'package:ultimate_mtg/model/blocprovider.dart';
  
  // ignore: camel_case_types
  class dropDownMenu extends StatefulWidget {
    final Function() onPressed;
    final String tooltip;
    final IconData icon;
    final _callback;
  
    dropDownMenu({Key key, this.onPressed, this.tooltip, this.icon, @required void singlePlayerCallbacks(String callBackType), @required StatefulWidget styleMenu }  ):
        _callback = singlePlayerCallbacks;
  
    @override
    dropDownMenuState createState() =&gt; dropDownMenuState();
  }
  
  // ignore: camel_case_types
  class dropDownMenuState extends State&lt;dropDownMenu&gt;
      with SingleTickerProviderStateMixin {
    bool isOpened = false;
    AnimationController _animationController;
    Animation&lt;double&gt; _translateButton;
    Curve _curve = Curves.easeOut;
    double _fabHeight = 58;
    double menuButtonSize = 55;
    Color menuButtonTheme;
    ColorBloc colorBloc = ColorBloc();
  
    @override
    initState() {
      _animationController =
      AnimationController(vsync: this, duration: Duration(milliseconds: 600))
        ..addListener(() {
          setState(() {});
        });
      _translateButton = Tween&lt;double&gt;(
        begin: 0.0,
        end: _fabHeight,
      ).animate(CurvedAnimation(
        parent: _animationController,
        curve: Interval(
          0.0,
          1.0,
          curve: _curve,
        ),
      ));
      super.initState();
    }
  
    @override
    dispose() {
      _animationController.dispose();
      colorBloc.dispose();
      super.dispose();
    }
  
    animate() {
      if (!isOpened) {
        _animationController.forward();
      } else {
        _animationController.reverse();
      }
      isOpened = !isOpened;
    }
  
    Widget backgroundColour() {
      return StreamBuilder(
        initialData: Colors.blue,
        stream: colorBloc.colorStream,
        builder: (BuildContext context, snapShot) =&gt; Container(
          width: menuButtonSize,
          height: menuButtonSize,
          child: RawMaterialButton(
            shape: CircleBorder(),
            fillColor: Colors.black,
            elevation: 5.0,
            onPressed: (){},
            child: Container(
              height: menuButtonSize - 3,
              width: menuButtonSize - 3,
              decoration: BoxDecoration(
                color: snapShot.data,
                shape: BoxShape.circle,
              ),
              child: Image.asset(
                'lib/images/background_colour.png',
                scale: 4,
              ),
            ),
          ),
        ),
      );
    }
  
    Widget toggle() {
      return Transform.rotate(
        angle: _animationController.value * (pi * 2),
        child: Container(
          width: menuButtonSize,
          height: menuButtonSize,
          child: RawMaterialButton(
            shape: CircleBorder(),
            fillColor: Colors.black,
            elevation: 5.0,
            onPressed: animate,
            child: SizedBox(
              height: menuButtonSize - 3,
              width: menuButtonSize - 3,
              child: Image.asset('lib/images/ic_launcher.png'),
            ),
          ),
        ),
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return Stack(
        children: &lt;Widget&gt; [
          BlocProvider(
            bloc: ColorBloc(),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Stack(
                  children: &lt;Widget&gt;[
                    Transform(
                      transform: Matrix4.translationValues(
                        0,
                        _translateButton.value,
                        0,
                      ),
                      child: backgroundColour(),
                    ),
                    toggle(),
                  ],
                ),
              ],
            ),
          ),
          Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: &lt;Widget&gt;[
              Container(
                height: menuButtonSize,
                width: menuButtonSize,
                child: Opacity(
                  opacity: 0.0,
                  child: FloatingActionButton(
                    heroTag: null,
                    onPressed: animate,
                  ),
                ),
              ),
              SizedBox(
                height: 3.0,
              ),
              Container(
                height: menuButtonSize,
                width: menuButtonSize,
                child: Opacity(
                  opacity: 0.0,
                  child: FloatingActionButton(
                    heroTag: null,
                    onPressed:  isOpened == true? (){
                      widget?._callback('background');
                    } : () {},
                  ),
                ),
              ),
            ],
          ),
        ],
      );
    }
  }
  </code></pre>
  
  <blockquote>
    <p>singleplayer.dart</p>
  </blockquote>
  
  <pre><code>import 'dart:async';
  import 'dart:io';
  import 'package:flutter/material.dart';
  import 'package:ultimate_mtg/dropdownmenu.dart';
  import 'package:ultimate_mtg/model/colorBloc.dart';
  
  class SinglePlayerMode extends StatefulWidget {
    @override
    SinglePlayerModeParentState createState() =&gt; SinglePlayerModeParentState();
  }
  
  class SinglePlayerModeParentState extends State&lt;SinglePlayerMode&gt; {
  
    ColorBloc colorBloc = ColorBloc();
  
    @override
    void initState() {
      super.initState();
      SystemChrome.setEnabledSystemUIOverlays([]);
      SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft,]);
      Screen.keepOn(true);
    }
  
    @override
    dispose() {
      colorBloc.dispose();
      super.dispose();
    }
  
    _changeColourButton() {
      colorBloc.changeColor();
    }
  
    @override
    Widget build(BuildContext context) {
      return WillPopScope(
        onWillPop: () =&gt; _exitApp(context),
        child: Scaffold(
          body: Container(
            child: Row(
              children: &lt;Widget&gt; [
                FloatingActionButton(
                  backgroundColor: Colors.blue,
                  heroTag: null,
                  onPressed: _changeColourButton,
                  child: Text(
                    'change',
                  ),
                ),
                dropDownMenu(
                  singlePlayerCallbacks: callBacks,
                ),
              ],
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>That's basically how I am trying to do it.</p>