title: Properly access ChangeNotifierProvider from Consumer Flutter
body: <p>I can't access my <code>ChangeNotifierProvider&lt;QuestionProvider&gt;</code> from <code>Consumer&lt;QuestionProvider&gt;</code> but I don't understand why, it's defined deeper in the widget tree compared to its provider.</p>
  <p>I defined my provider here :</p>
  <pre><code>body: GestureDetector(
          onTap: () =&gt; FocusManager.instance.primaryFocus?.unfocus(),
          child: ChangeNotifierProvider&lt;QuestionProvider&gt;(
              //TODO : question provider arguments should come from internet
              create: (newContext) =&gt; QuestionProvider([], pageController),
              child: Column(
                children: [
                  TypeAndSettingsRow(),
  </code></pre>
  <p>Consumer is defined in a next widget defined inside <code>TypeAndSettingsRow</code> :</p>
  <pre><code>class TypeAndSettingsRow extends StatefulWidget {
    @override
    State&lt;TypeAndSettingsRow&gt; createState() =&gt; _TypeAndSettingsRowState();
  }
  
  class _TypeAndSettingsRowState extends State&lt;TypeAndSettingsRow&gt; {
    @override
    Widget build(BuildContext context) {
  
      void showPopoverType() {
        int thisIsTrue = 0;
        double size = MediaQuery.of(context).size.width * 0.9;
        showPopover(
          context: context,
          tion(milliseconds: 150),
          bodyBuilder: (context) =&gt; CheckboxListTileRow(),
  </code></pre>
  <p>And finally <code>CheckboxListTileRow</code> :</p>
  <pre><code>class _CheckboxListTileRowState extends State&lt;CheckboxListTileRow&gt; {
    @override
    Widget build(BuildContext context) {
      return Consumer&lt;QuestionProvider&gt;(builder: ((context, value, child) {
  </code></pre>
  <p><code>QuestionProvider</code> :</p>
  <pre><code>class QuestionProvider extends ChangeNotifier {
  </code></pre>
  <p>When I open <code>CheckboxListTileRow</code> this is the error :</p>
  <pre><code>Error: Could not find the correct Provider&lt;QuestionProvider&gt; above this Consumer&lt;QuestionProvider&gt; Widget
  
  This happens because you used a `BuildContext` that does not include the provider
  of your choice. There are a few common scenarios:
   You added a new provider in your `main.dart` and performed a hot-reload.
    To fix, perform a hot-restart.
  
  - The provider you are trying to read is in a different route.
  
    Providers are &quot;scoped&quot;. So if you insert of provider inside a route, then
    other routes will not be able to access that provider.
  
  - You used a `BuildContext` that is an ancestor of the provider you are trying to read.
  
    Make sure that Consumer&lt;QuestionProvider&gt; is under your MultiProvider/Provider&lt;QuestionProvider&gt;.
  </code></pre>
  <p>I don't understand which is the problem because my provider is defined above in the widget tree respect of its consumer so it should be reachable.</p>
  <p>Maybe there are some errors with <code>context</code>s?</p>
  <p><strong>EDIT</strong> :</p>
  <p>Found out that the problem is <code>showPopover</code> form  <a href="https://pub.dev/packages/popover" rel="nofollow noreferrer">popover package</a>, when I try to access <code>ChangeNotifierProvider</code> with <code>Consumer</code> within <code>showPopover</code>  this error is thrown but if I do it outside then it works.
  Probably it creates a new route and I can't access my provider anymore.
  Hope this new hint can help to fix because question is still open.</p>