title: Can't read provider data inspite of having it in an ancesstor widget. Flutter
body: <p>I just started with Provider package of flutter, I learnt that we have to provide the provider in a parent class and that is what  is did. But I am still getting this error. I have  a feeling it has something to do with the route generator. Any help is much appreciated</p>
  <p>My main app code:</p>
  <pre><code>class MyApp extends StatelessWidget {
    // This widget is the root of your application.
    final MaterialColor primary =
        MaterialColor(0xff1A365D, &lt;int, Color&gt;{500: Color(0xff1A365D)});
    @override
    Widget build(BuildContext context) {
      return ChangeNotifierProvider(
        create: (_) =&gt; AuthInfoProvider(),
        child: MaterialApp(
          title: 'xxx',
          debugShowCheckedModeBanner: false,
          theme: ThemeData(
              // This is the theme of your application.
              //
              // Try running your application with &quot;flutter run&quot;. You'll see the
              // application has a blue toolbar. Then, without quitting the app, try
              // changing the primarySwatch below to Colors.green and then invoke
              // &quot;hot reload&quot; (press &quot;r&quot; in the console where you ran &quot;flutter run&quot;,
              // or simply save your changes to &quot;hot reload&quot; in a Flutter IDE).
              // Notice that the counter didn't reset back to zero; the application
              // is not restarted.
              primaryColor: Color(0xff1A365D),
              accentColor: Color(0xff4299E1),
              buttonColor: Color(0xff1A365D),
              floatingActionButtonTheme: FloatingActionButtonThemeData(
                  backgroundColor: Color(0xff1A365D))),
          onGenerateRoute: RouteGenerator.generateRoute,
          initialRoute: '/auth/wrapper',
        ),
      );
    }
  }
  </code></pre>
  <p>My Route generator code:</p>
  <pre><code>class RouteGenerator {
    static Route&lt;dynamic&gt; generateRoute(RouteSettings settings) {
      final args = settings.arguments;
  
      switch (settings.name) {
        case '/auth/wrapper':
          return MaterialPageRoute(builder: (_) =&gt; AuthWrapper());
        case '/auth/wrapper/login':
          return MaterialPageRoute(builder: (_) =&gt; Login());
        case '/app/activeevents':
          return MaterialPageRoute(builder: (_) =&gt; PaginatedActiveEvents());
        default:
          return MaterialPageRoute(builder: (_) =&gt; ErrorRoute());
      }
    }
  }
  </code></pre>
  <p>My App Wrapper Code where I need to use the provider.</p>
  <pre><code>class AuthWrapper extends StatelessWidget {
    const AuthWrapper({Key? key}) : super(key: key);
  
    @override
    Widget build(BuildContext context) {
      final authInfo = Provider.of&lt;AuthInfo&gt;(context);
      return authInfo.isFirst ? Landing() : Signup();
    }
  }
  </code></pre>
  <p>My Provider code :</p>
  <pre><code>class AuthInfoProvider with ChangeNotifier {
    AuthInfo _authInfo = new AuthInfo();
  
    AuthInfo get authInfo =&gt; _authInfo;
  
    void setIsFirst() {
      _authInfo.isFirst = false;
      notifyListeners();
    }
  }
  </code></pre>
  <p>The Error I am getting:
  <a href="https://i.stack.imgur.com/jC9Zs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jC9Zs.png" alt="enter image description here" /></a></p>
  <p>I am new to Provider, how do I fix this. Help is very much appreciated</p>