title: How can I Initialize provider?
body: <p>I have implemented Provider for state management in my app. Now, I need to add some data in the class once the screen is loaded.</p>
  
  <p>How I can achieve this?</p>
  
  <pre class="lang-dart prettyprint-override"><code>stepInfo.addToList = new VaccStep(); // Need to call it one time once screen is loaded.
  </code></pre>
  
  <p>I have tried to call this method from initState but it's giving error!!</p>
  
  <pre class="lang-dart prettyprint-override"><code>class AdminAddVaccination extends StatefulWidget {
    @override
    State createState() =&gt; new AdminAddVaccinationState();
  }
  
  class AdminAddVaccinationState extends State&lt;AdminAddVaccination&gt; {
  
    @override
    void initState() {
      super.initState();
      var stepInfo = Provider.of&lt;StepInfo&gt;(context); // ERROR!!
      stepInfo.addToList = new VaccStep(); // ERROR!!
    }
  
    Widget build(BuildContext context) {
      return new ChangeNotifierProvider(
        builder: (context) =&gt; StepInfo(),
        child: ScreenBody(),
      );
    }
  }
  
  class ScreenBody extends StatelessWidget {
  
  
    @override
    Widget build(BuildContext context) {
      var stepInfo = Provider.of&lt;StepInfo&gt;(context);
  
      return new Scaffold(
          resizeToAvoidBottomPadding: false,
          key: stepInfo.scaffoldKey,
          body: new GestureDetector(
              onTap: () {
                FocusScope.of(context).requestFocus(new FocusNode());
              },
              child: new SafeArea(
                top: true,
                bottom: false,
                child: new Stack(children: &lt;Widget&gt;[
                  new Opacity(
                    opacity: 0.04,
                    child: new Image.asset(
                      "assets/userProfile/heartBeat.png",
                      fit: BoxFit.cover,
                      height: 250.0,
                    ),
                  ),
                  new Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: &lt;Widget&gt;[
                      new Container(
                        color: primaryGreen,
                        width: double.infinity,
                        height: 65.0,
                        child: new Stack(
                          children: &lt;Widget&gt;[
                            new Align(
                                alignment: Alignment.center,
                                child: stepInfo.loading
                                    ? JumpingText('......')
                                    : new Container()),
                            new Align(
                              alignment: Alignment.centerLeft,
                              child: new Padding(
                                padding: EdgeInsets.only(top: 5.0, left: 20.0),
                                child: new InkWell(
                                  child: new Container(
                                    child: Icon(
                                      Icons.arrow_back,
                                      color: Colors.white,
                                      size: 30.0,
                                    ),
                                  ),
                                  onTap: () {
                                    Navigator.pop(context);
                                  },
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                      new Padding(
                        padding: EdgeInsets.only(top: 0.0),
                        child: new Material(
                          elevation: 1.0,
                          color: Colors.transparent,
                          child: new Container(
                            color: borderColor,
                            width: double.infinity,
                            height: 5.0,
                          ),
                        ),
                      ),
                      VaccName(),
                    ],
                  ),
                  ItemListing(),
                  AddStep(),
                ]),
              )));
    }
  }
  </code></pre>
  
  <blockquote>
    <p>Error!! flutter: The following ProviderNotFoundError was thrown
    building  Builder: flutter: Error: Could not find the correct
    Provider above this AdminAddVaccination Widget flutter:
    flutter: To fix, please: flutter: flutter:   * Ensure the
    Provider is an ancestor to this AdminAddVaccination Widget
    flutter:   * Provide types to Provider flutter:   * Provide
    types to Consumer flutter:   * Provide types to
    Provider.of() flutter:   * Always use package imports. Ex:
    `import 'package:my_app/my_code.dart';</p>
  </blockquote>