title: How use provider in onGenerateRoute?
body: <p>How can i use my UserProvider in onGenerateRoute?
  I want to check if user is logger using UserProvider.isLogged(), but when i trying to get Userprovider i must to pass context with i dont have in Router.</p>
  
  <p>I already trying to change generateRoute to non-static and pass context by constructor to Router but it throw error.</p>
  
  <p>main.dart</p>
  
  <pre><code>void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
  
      return MultiProvider(
        providers: &lt;SingleChildCloneableWidget&gt;[
          ChangeNotifierProvider(builder: (_) =&gt; BottomNavigationBarProvider()),
          ChangeNotifierProvider(builder: (_) =&gt; UserProvider()),
        ],
        child: MaterialApp(
        initialRoute: '/',
        onGenerateRoute: Router.generateRoute,
        title: 'Title,
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
      ),);
  
  }
  }
  </code></pre>
  
  <p>Router.dart</p>
  
  <pre><code>class Router {
  
    static Route&lt;dynamic&gt; generateRoute(RouteSettings settings) {
      switch (settings.name) {
        case '/':
          return MaterialPageRoute(builder: (_) =&gt; HomePage());
          break;
        case '/login':
          return MaterialPageRoute(builder: (_) =&gt; LoginPage());
          break;
        case '/register':
          return MaterialPageRoute(builder: (_) =&gt; RegisterPage());
          break;
        case '/terms':
          return MaterialPageRoute(builder: (_) =&gt; TermsPage());
          break;
        case '/home':
          return MaterialPageRoute(builder: (_) {
            return HomePage();
          });
          break;
        default:
          return MaterialPageRoute(
              builder: (_) =&gt; Scaffold(
                    body: Center(
                        child: Text('No route defined for ${settings.name}')),
                  ));
          break;
      }
    }
  }
  </code></pre>
  
  <p>===MY TRY===</p>
  
  <p>main.dart</p>
  
  <pre><code>onGenerateRoute: Router(context).generateRoute,
  </code></pre>
  
  <p>Router.dart</p>
  
  <pre><code>class Router {
    Router(this.context);
  
    BuildContext context;
  
    Route&lt;dynamic&gt; generateRoute(RouteSettings settings) {
      final UserProvider userProvider = Provider.of&lt;UserProvider&gt;(context);
       userProvider.isLogged();
      switch (settings.name) {
        case '/':
          return MaterialPageRoute(builder: (_) =&gt; HomePage());
          break;
        case '/login':
          return MaterialPageRoute(builder: (_) =&gt; LoginPage());
          break;
        case '/register':
          return MaterialPageRoute(builder: (_) =&gt; RegisterPage());
          break;
        case '/terms':
          return MaterialPageRoute(builder: (_) =&gt; TermsPage());
          break;
        case '/home':
          return MaterialPageRoute(builder: (_) { 
  
            return HomePage();});
          break;
        default:
          return MaterialPageRoute(
              builder: (_) =&gt; Scaffold(
                    body: Center(
                        child: Text('No route defined for ${settings.name}')),
                  ));
          break;
      }
    }
  }
  </code></pre>
  
  <p>This "My try" gives me error. How can i do that? "Could not find the correct ProviderProvider> above this MyApp widget."</p>