title: How to navigate different page after async method return response
body: <p>I have a screen App in which i have onGenerateRoute property of MaterialApp. In the routes method i make an api call and once i get the response i want to let user navigate to login screen</p>
  
  <p>I tried calling my widget Login inside .then() function</p>
  
  <pre><code>class App extends StatelessWidget {
    Widget build(BuildContext context) {
      return AppBlocProvider(
        child: LoginBlocProvider(
          child: MaterialApp(
            onGenerateRoute: routes,
          ),
        ),
      );
    }
  
    Route routes(RouteSettings settings) {
      print(settings.name);
      switch (settings.name) {
        case '/':
          return MaterialPageRoute(builder: (context) {
            //HERE I AM MAKING API CALL
            final appBloc = AppBlocProvider.of(context);
            appBloc.verifyUser().then((response) {
              //HERE ONCE I GET THE RESPONSE I WANT TO NAVIGATE USER TO 
              //lOGIN ACTIVITY
              print('called');
              return Login();
            });
            return AppBlocProvider(
              child: Center(child: CircularProgressIndicator()),
            );
          });
          break;
        case '/Login':
          return MaterialPageRoute(builder: (BuildContext context) {
            return Login();
          });
          break;
        case '/HomeScreen':
          return MaterialPageRoute(builder: (BuildContext context) {
            return Home();
          });
          break;
      }
      return MaterialPageRoute(builder: (context) {
        print('returned null');
      });
    }
  </code></pre>
  
  <p>api call get successful and even .then() method executes but login screen doesn't appear</p>