title: Flutter Slider loop in BlocBuilder
body: <p>I use a slider in a BlocBuilder which allows me to retrieve an initial value, but when I want to change the slider's value, I always enter the LightStateOn condition and my value takes the state.brightness value.</p>
  
  <pre><code>BlocBuilder&lt;LightBloc, LightState&gt;(
      builder: (context, state) {
    if (state is LightStateOn) {
      this.brightness = state.brightness.toDouble();
      return Slider(
        value: this.brightness,
        min: 0,
        max: 255,
        onChanged: (value) {
          setState(() =&gt; this.brightness = value);
        },
      );
      // );
    } else {
      return ...
    }
  }),
  </code></pre>
  
  <p>There must be something I didn't understand. Can somebody please explain it to me ?</p>