title: Flutter - Pass state change function to child widget and update state
body: <p><a href="https://i.stack.imgur.com/OZEvm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OZEvm.png" alt="Home Page"></a></p>
  
  <p>I am new to flutter and building a sample app to learn it. In the above screenshot, I have created multiple widgets. My main widget contains the following widget.</p>
  
  <ol>
  <li>Boy Girl Selector </li>
  <li>Common Card 
  
  <ol>
  <li>CounterButton (Plus or Minus)</li>
  </ol></li>
  <li>Calculate Button</li>
  </ol>
  
  <p>My main widget has two counter - age &amp; weight.
  CommonCard has below property :
     incrementFunction() : I am setting this value from MainWidget as below.
     decrementFunction()</p>
  
  <pre><code>  ageIncrement() {
      setState(() {
        age++;
      });
    }
    ageDecrement() {
      setState(() {
        age--;
      });
    }
  </code></pre>
  
  <p>value : age declared in main widget is passed to this value.</p>
  
  <p>CounterButton has below property.
  onPressed: increment or decrement function from parent widget is passed here through card widget.</p>
  
  <p>If I keep whole code in main widget then it is working properly. But if I create multiple widget and pass increment and decrement function as argument in child widget onPressed on plus and minus is not working propely. Please share your thoughts. I am missing some fundamental of communication between child and parent widget.</p>