title: Error: Could not find the correct Provider<TimerState> above this Practice4HomePage Widget Flutter(BLoc)
body: <p>I got an error when learning bloc in flutter</p>
  <p>Error is
  Error: Could not find the correct Provider above this Practice4HomePage Widget</p>
  <p>This happens because you used a <code>BuildContext</code> that does not include the provider
  of your choice. There are a few common scenarios:</p>
  <ul>
  <li><p>You added a new provider in your <code>main.dart</code> and performed a hot-reload.
  To fix, perform a hot-restart.</p>
  </li>
  <li><p>The provider you are trying to read is in a different route.</p>
  <p>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.</p>
  </li>
  <li><p>You used a <code>BuildContext</code> that is an ancestor of the provider you are trying to read.</p>
  <p>Make sure that Practice4HomePage is under your MultiProvider/Provider.
  This usually happens when you are creating a provider and trying to read it immediately.</p>
  <p>For example, instead of:</p>
  <pre><code>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;()),
    ),
  }
  </code></pre>
  <p>consider using <code>builder</code> like so:</p>
  <pre><code>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
      builder: (context) {
        // No longer throws
        return Text(context.watch&lt;Example&gt;()),
      }
    ),
  }
  </code></pre>
  </li>
  </ul>