title: Could not find the correct Provider - Flutter
body: <pre><code>  @override
    Widget build(BuildContext context) {
  
      return WillPopScope(
        onWillPop: () async {
          return false;
        },
        child: Stack(
          children: &lt;Widget&gt;[
            DefaultTabController(
              length: 5,
              child: ChangeNotifierProvider(
                builder: (context) =&gt; MySchedule(),
                child: (
                    Scaffold(
                      appBar: AppBar(
                        actions: &lt;Widget&gt;[
                          Container(
                            width: MediaQuery.of(context).size.width,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: &lt;Widget&gt;[
                                GestureDetector(
                                  onTap: () async{
                                    await Navigator.of(context).push(
                                      MaterialPageRoute(builder: (context){
                                        return InApp();
                                      })
                                    );
                                    final MySchedule schedules = Provider.of&lt;MySchedule&gt;(context);
                                    schedules.numberOfCoins = 10;
                                  },
                                  child: Card(
                                    child: Padding(
                                      padding: const EdgeInsets.all(4.0),
                                      child: Row(
                                        children: &lt;Widget&gt;[
                                          Consumer&lt;MySchedule&gt;(
                                            builder: (context, coin, _) =&gt;
                                                buildCoinBar(coin),
                                          ),
                                          SizedBox(
                                            width: 2,
                                          ),
                                          Stack(
                                            children: &lt;Widget&gt;[
                                              Image.asset('assets/coin2.png',
                                                height: 22, width: 22,),
  
                                            ],
                                          ),
                                        ],
                                      ),
                                    ),
                                  ),
                                ),
                                Image.asset('assets/LOGO.png'),
                                Consumer&lt;MySchedule&gt;(
                                  builder: (context, userdata, _) =&gt;
                                      topRightElement(userdata, context),
                                ),
                              ],
                            ),
                          )
                        ],
                        automaticallyImplyLeading: false,
                        bottom: TabBar(
                          labelStyle: TextStyle(fontSize: 8),
                          tabs: [
                            Consumer&lt;MySchedule&gt;(
                              builder: (context, schedule, _) =&gt;
                              buildNewCardNotification(schedule),
                            ),
                            Tab(icon: Icon(Icons.star), text: 'Csapatom' ,),
                            Tab(icon: Icon(Icons.verified_user), text: 'Forduló',),
                            Tab(icon: Icon(Icons.stars), text: 'Kártyáim',),
                            Tab(icon: Icon(Icons.account_balance), text: 'Ligák',),
                          ],
                        ),
                      ),
                      body: TabBarView(
                        children: [
                          Office(),
                          MyTeam(),
                          MatchListView(),
                          MyCardView(),
                          ChampionshipView2(),
                        ],
                      ),
                    )
                ),
              ),
            ),
            Visibility(
              visible: msgVisible,
              child: SafeArea(
                child: GestureDetector(
                  onTap: (){
                    setState(() {
                      msgVisible = false;
                    });
                  },
                  child: Padding(
                    padding: const EdgeInsets.all(2.0),
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(0.0),
                      child: Card(
                        shape: RoundedRectangleBorder(
                            side: new BorderSide(color: Colors.lightGreenAccent, width: 2.0),
                            borderRadius: BorderRadius.circular(16.0)),
                        elevation: 8,
                        color: Colors.black87,
                        child: Container(
                          height: 64,
                          width: MediaQuery.of(context).size.width,
                          child: Row(
                            children: &lt;Widget&gt;[
                              Padding(
                                padding: const EdgeInsets.all(10.0),
                                child: Image.asset('assets/LOGO.png', height:44),
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                                children: &lt;Widget&gt;[
                                  Text(title, style: TextStyle(
                                    fontSize: 16,
                                    color: Colors.lightGreenAccent
                                  ),),
                                  Text(body,
                                    overflow: TextOverflow.ellipsis)
                                ],
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
              ),
            )
          ],
        ),
      );
    }
  </code></pre>
  <p>I try to modify the numberOfCoins variable, when I pop the InApp() class.
  But I have the following error:</p>
  <blockquote>
  <p>[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: Error: Could
  not find the correct Provider above this FantasyNbi Widget</p>
  <p>To fix, please:</p>
  <ul>
  <li>Ensure the Provider is an ancestor to this FantasyNbi
  Widget   * Provide types to Provider   * Provide types to
  Consumer   * Provide types to Provider.of()</li>
  <li>Always use package imports. Ex: <code>import 'package:my_app/my_code.dart';   * Ensure the correct </code>context` is
  being used.</li>
  </ul>
  </blockquote>