title: Flutter: checkBox onChanged
body: <p>I was trying to implement a checkbox that would disable and enable a button. But I was blocked by this following error:</p>
  
  <pre><code>I/flutter (19999): The following assertion was thrown building DisclaimerPage(dirty, state: DisclaimerPageState#24b3d):
  I/flutter (19999): setState() or markNeedsBuild() called during build.
  I/flutter (19999): This Overlay widget cannot be marked as needing to build because the framework is already in the
  I/flutter (19999): process of building widgets. A widget can be marked as needing to be built during the build phase
  I/flutter (19999): only if one of its ancestors is currently building. This exception is allowed because the framework
  I/flutter (19999): builds parent widgets before children, which means a dirty descendant will always be built.
  I/flutter (19999): Otherwise, the framework might not visit this widget during this build phase.
  </code></pre>
  
  <p>Here is my code for building the page:</p>
  
  <pre><code>class DisclaimerPageState extends State&lt;DisclaimerPage&gt; {
    bool checkBoxValue = false;
  
    @override
    Widget build(BuildContext context) {
      var _floatButtonOnPressed;
  
      if (checkBoxValue) {
        _floatButtonOnPressed = navToHome();
      }
  
      return new Scaffold(
        appBar: AppBar(
          title: Text("Disclaimer"),
          leading: Container(),
        ),
        body: Container(
          child: Card(
            child: Column(
              children: &lt;Widget&gt;[
                Text("ADHJASDKHKDAD"),
                Row(
                  children: &lt;Widget&gt;[
                    Checkbox(
                        value: checkBoxValue,
                        onChanged: (bool newValue) {
                          setState(() {
                            checkBoxValue = newValue;
                          });
                        }),
                    Text("I understand"),
                  ],
                ),
              ],
            ),
          ),
        ),
        floatingActionButton: FloatingActionButton.extended(
          onPressed: _floatButtonOnPressed,
          label: Text("PROCEED"),
          icon: Container(),
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      );
    }
  
    navToHome() {
      Navigator.push(
        context,
        MaterialPageRoute(
            builder: (context) =&gt; ImmunityHomePage(title: 'ImMUnity')),
      );
    }
  }
  </code></pre>
  
  <p>Am I doing something wrong? My checkbox implementation is based on the documentation of checkbox.dart. So I am a little confused here. Help is appreciated. Thank you so much!</p>