title: Could not find the correct Provider<FirebaseUser> above this HomePage Widget
body: <p>I just started to refactor my apps structure using the provider package. Now I get the error above, even though I'm calling the provider down the widget tree in the next BuildContext.
  Any idea what could cause the error? As far as I understand, the common error cases explained in the error message shouldn't apply to me.
  <a href="https://i.stack.imgur.com/5ivtV.png" rel="nofollow noreferrer">Widget tree</a></p>
  
  <pre><code>class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MultiProvider(
        providers: [
          Provider(create: (_) =&gt; FirebaseAuth.instance.onAuthStateChanged)
        ],
        child: MaterialApp(
            title: "My App",
            home: HomePage()),
      );
    }
  }
  
  class HomePage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return _getLandingPage(Provider.of&lt;FirebaseUser&gt;(context), context);
    }
  
    Widget _getLandingPage(FirebaseUser firebaseUser, context) {
      if (firebaseUser != null) {
          return CreateProfileFlow();
  
      } else {
        return PhoneNrInput();
      }
    }
  }
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>Error: Could not find the correct Provider&lt;FirebaseUser&gt; above this HomePage Widget
  
  This likely happens because you used a `BuildContext` that does not include the provider
  of your choice. There are a few common scenarios:
  
  - The provider you are trying to read is in a different route.
  
    Providers are "scoped". 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 HomePage is under your MultiProvider/Provider&lt;FirebaseUser&gt;.
    This usually happen when you are creating a provider and trying to read it immediatly.
  
    For example, instead of:
  
    ```
    Widget build(BuildContext context) {
      return Provider&lt;Example&gt;(
        create: (_) =&gt; Example(),
        // Will throw a ProviderNotFoundError, because `context` is associated
        // to the widget that is the parent of `Provider&lt;Example&gt;`
        child: Text(context.watch&lt;Example&gt;()),
      ),
    }
    ```
  
    consider using `builder` like so:
  
    ```
    Widget build(BuildContext context) {
      return Provider&lt;Example&gt;(
        create: (_) =&gt; Example(),
        // we use `builder` to obtain a new `BuildContext` that has access to the provider
        builer: (context) {
          // No longer throws
          return Text(context.watch&lt;Example&gt;()),
        }
      ),
    }
    ```
  
  If none of these solutions work, consider asking for help on StackOverflow:
  https://stackoverflow.com/questions/tagged/flutter
  </code></pre>