title: Flutter : 'Future <dynamic>' is not a subtype of type bool
body: <p>I was trying to implement a simple login/logout functionality. My scenario is this:</p>
  <p>I have 2 pages ( login page and home page), In the <code>main.dart</code>, I am using SharedPreferences to check if a user has already logged in or not if the user is logged in, I set a boolean value as true on click of a button.</p>
  <p>The issue I am having is, I have a routeLogin function that I created to choose between Homepage and Landingpage.
  And I get this error:</p>
  <pre><code>I/flutter ( 9026): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  I/flutter ( 9026): The following assertion was thrown building MyApp(dirty):
  I/flutter ( 9026): type 'Future&lt;dynamic&gt;' is not a subtype of type 'bool'
  I/flutter ( 9026):
  I/flutter ( 9026): Either the assertion indicates an error in the framework itself, or we should provide substantially
  I/flutter ( 9026): more information in this error message to help you determine and fix the underlying cause.
  I/flutter ( 9026): In either case, please report this assertion by filing a bug on GitHub:
  I/flutter ( 9026):   https://github.com/flutter/flutter/issues/new?template=BUG.md
  </code></pre>
  <p>This is my code :</p>
  <pre><code>import 'package:credit/src/pages/landing.dart';
  import 'package:flutter/material.dart';
  import 'package:credit/src/pages/credit/home.dart';
  import 'package:shared_preferences/shared_preferences.dart';
  
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatelessWidget {
    // This widget is the root of your application.
  
   bool checkValue;
   checkLoginValue () async{
     SharedPreferences loginCheck = await SharedPreferences.getInstance();
     checkValue = loginCheck.getBool(&quot;login&quot;);
     }
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Test App',
         debugShowCheckedModeBanner: false,
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: routeLogin());
        //home: LandingPage());      
    }
  
    routeLogin()
    {
      print(&quot;Check value&quot;);
      if (checkValue == null){
        return LandingPage();
      }
      else{
        return HomePage();
      }
      
    }
  }
  </code></pre>
  <p>Please let me know where did I went wrong, I am new to Flutter.</p>