title: Flutter: Is it possible to access the parent State of a BuildContext?
body: <p>Is it possible to access a <code>BuildContext</code>'s parent state from the <code>BuildContext</code> object?</p>
  
  <p>For example:</p>
  
  <pre><code>class importantMethods {
    static int importantVariable = 1;
    static void increment(BuildContext context) {
      context.&lt;parentState&gt;.setState((){
          importantVariable += 1;
      });//I wonder if this function is possible
    }
  }
  
  class importantWidget extends StatefulWidget {
    @override
    State&lt;StatefulWidget&gt; createState() {
      return importantWidgetState();
    }
  }
  
  class importantWidgetState extends State&lt;importantWidget&gt; {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Center(
          child: Column(children: &lt;Widget&gt;[
            Text(importantMethods.importantVariable.toString()),
            FlatButton(
              child: Text("Increment"),
              onPressed: () {
                importantMethods.increment(context);
              },
            ),
          ]),
        ),
      );
    }
  }
  </code></pre>