title: How can i get value from child to parent on button click when button is in parent?
body: <p>I have been using Stepper view by flutter.And I am having an issue on getting value from child to parent on button click as the button is in parent widget.</p>
  <p>Here is my Parent class and my child class.</p>
  <p><strong>Parent Class</strong>
  This is my parent class which has a Stepper view with next and back button.I want to get value from my child class to parent class when next button is clicked.</p>
  <pre><code>   class DeliveryTimeline extends StatefulWidget {
        DeliveryTimeline({Key key, this.title}) : super(key: key);
      
        final String title;
      
        @override
        _MyHomePageState createState() =&gt; new _MyHomePageState();
      }
      
      class _MyHomePageState extends State&lt;DeliveryTimeline&gt; {
        int _currentStep = 0;
        String shippingtype;
      
        @override
        Widget build(BuildContext context) {
          return new Scaffold(
              appBar: AppBar(
                backgroundColor: Colors.white,
                centerTitle: true,
                iconTheme: new IconThemeData(color: Colors.black),
                elevation: 0,
                title: Text(
                  &quot;Checkout&quot;,
                  style: TextStyle(color: Colors.black),
                ),
              ),
              body: Stepper(
                  type: StepperType.horizontal,
                  steps: _mySteps(),
                  currentStep: this._currentStep,
                  onStepTapped: (step) {
                    setState(() {
                      this._currentStep = step;
                    });
                  },
                  onStepContinue: () {
                    setState(() {
                      if (this._currentStep == 0) {
                        this._currentStep = this._currentStep + 1;
  
  **//need to get value here on first next click**
  
                      } else if (this._currentStep == 1) {
                        this._currentStep = this._currentStep + 1;
                      } else {
                        print('Completed, check fields.');
                      }
      
                    });
                  },
                  onStepCancel: () {
                    setState(() {
                      if (this._currentStep &gt; 0) {
                        this._currentStep = this._currentStep - 1;
                      } else {
                        this._currentStep = 0;
                      }
                    });
                  },
                  controlsBuilder: (BuildContext context,
                      {VoidCallback onStepContinue,
                      VoidCallback onStepCancel,
                      Function onShippingNextClick}) {
                    return Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: &lt;Widget&gt;[
                        OutlineButton(
                            child: new Text(&quot;Back&quot;),
                            onPressed: onStepCancel,
                            shape: new RoundedRectangleBorder(
                                borderRadius: new BorderRadius.circular(4.0))),
                        MaterialButton(
                          child: Text(&quot;Next&quot;),
                          color: AppColors.primarycolor,
                          textColor: Colors.white,
                          onPressed: onStepContinue,
                        ),
                      ],
                    );
                  }));
        }
      
        List&lt;Step&gt; _mySteps() {
          List&lt;Step&gt; _steps = [
            Step(
              title: Text('Delivery'),
              content: Center(
                child: Container(
                  height: MediaQuery.of(context).size.height / 1.5,
                  child: Delivery(onShipingTypeClicked: (shippingtype){
                    shippingtype = shippingtype;
                    print(&quot;myvalue${shippingtype}&quot;);
                  },),
                ),
              ),
              isActive: _currentStep &gt;= 0,
            ),
            Step(
              title: Text('Address'),
              content: Address(),
              isActive: _currentStep &gt;= 1,
            ),
            Step(
              title: Text('Payment'),
              content: Payment(),
              isActive: _currentStep &gt;= 2,
            )
          ];
          return _steps;
        }
      
      
      }
  </code></pre>
  <p><strong>Child Class</strong>
  This is my child class i have a Listview which act like a radio button.I want the selected item and its value to the parent class when button is clicked..</p>
  <pre><code>class Delivery extends StatefulWidget {
    final ValueChanged&lt;String&gt; onShipingTypeClicked;
  
     Delivery({this.onShipingTypeClicked});
  
    @override
    _DeliveryState createState() =&gt; _DeliveryState();
  }
  
  class _DeliveryState extends State&lt;Delivery&gt; {
  
    List&lt;RadioModel&gt; sampleData = new List&lt;RadioModel&gt;();
  
  
  
  
    @override
    void initState() {
      // TODO: implement initState
      super.initState();
      sampleData.add(new RadioModel(false, 'A', 0xffe6194B, &quot;Standard Delivery&quot;,
          &quot;Order will be delivered between 3 - 5 business days&quot;, 1));
      sampleData.add(new RadioModel(
          true,
          'A',
          0xffe6194B,
          &quot;Next Day Delivery&quot;,
          &quot;Place your order before 6pm and your items will be delivered the next day&quot;,
          2));
      sampleData.add(new RadioModel(
          false,
          'A',
          0xffe6194B,
          &quot;Nominated Delivery&quot;,
          &quot;Pick a particular date from the calendar and order will be delivered on selected date&quot;,
          3));
  
  
    }
  
    @override
    Widget build(BuildContext context) {
      return new Scaffold(
        body: new ListView.builder(
          itemCount: sampleData.length,
          shrinkWrap: true,
          physics: NeverScrollableScrollPhysics(),
          itemBuilder: (BuildContext context, int index) {
            return new InkWell(
                onTap: () {
                  setState(() {
                    sampleData.forEach((element) =&gt; element.isSelected = false);
                    sampleData[index].isSelected = true;
                    widget.onShipingTypeClicked(sampleData[index].buttonText);
                  });
                },
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: &lt;Widget&gt;[
                    TextSmallTitleSize(
                      title: sampleData[index].title,
                    ),
                    Padding(
                      padding: const EdgeInsets.only(bottom: 20.0),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: &lt;Widget&gt;[
                          Flexible(
                            child: TextSmallDimText(sampleData[index].label),
                          ),
                          RadioItem(sampleData[index]),
                        ],
                      ),
                    )
                  ],
                ));
          },
        ),
      );
    }
  }
  
  class RadioItem extends StatelessWidget {
    final RadioModel _item;
  
    RadioItem(this._item);
  
    @override
    Widget build(BuildContext context) {
      return new Container(
        margin: new EdgeInsets.all(15.0),
        child: new Row(
          mainAxisSize: MainAxisSize.max,
          children: &lt;Widget&gt;[
            new Container(
              height: 25.0,
              width: 25.0,
              alignment: Alignment.center,
              child: Container(
                  height: 15.0,
                  width: 15.0,
                  decoration: new BoxDecoration(
                    color: AppColors.primarycolor,
                    borderRadius:
                        const BorderRadius.all(const Radius.circular(15)),
                  )),
              decoration: new BoxDecoration(
                color: Colors.transparent,
                border: new Border.all(
                    width: 3.0,
                    color: _item.isSelected
                        ? AppColors.primarycolor
                        : Colors.transparent),
                borderRadius: const BorderRadius.all(const Radius.circular(25)),
              ),
            ),
            new Container(margin: new EdgeInsets.only(left: 10.0))
          ],
        ),
      );
    }
  }
  
  class RadioModel {
    bool isSelected;
    final String buttonText;
    final int colorCode;
    final String title, label;
    final int buttonid;
  
    RadioModel(this.isSelected, this.buttonText, this.colorCode, this.title,
        this.label, this.buttonid);
  }
  </code></pre>