title: Check if db exist before displaying any page
body: <p>I want to check if local db is null or not before displaying any page.</p>
  <p>I implemented a code in database helper class:</p>
  <pre><code>Future checkDb() async{
        var db = await getDatabasesPath();
        var dbPath = join(db,&quot;main.db&quot;);
        bool exist = await databaseExists(dbPath);
        return exist;
    }
  
  Future&lt;Database&gt; get db async{
      if(_db!= null)
      {
        return _db;
      }
      _db = await initdb();
      return _db;
    }
  
    initdb() async{
      Directory documentDirectory = await getApplicationDocumentsDirectory();
      String path = join(documentDirectory.path,&quot;main.db&quot;);
      var ourDb = await openDatabase(path,version:1,onCreate:_onCreate);
      return ourDb;
  
    }
  
    void _onCreate(Database db,int version)async {
      await db.execute(&quot;CREATE TABLE User(&quot;
            &quot;userId INTEGER PRIMARY KEY,&quot;
            &quot;first_name TEXT,&quot;
            &quot;last_name TEXT,&quot;
            &quot;user_password TEXT,&quot;
            &quot;)&quot;);
      print(&quot;User Table created&quot;);
      
    }
    //insertion of data
    Future&lt;int&gt; saveUser(User user)async {
      var dbClient = await db;
      int res = await dbClient.insert(&quot;User&quot;, user.tMap());
      return res;
    }
  
  </code></pre>
  <p>If this returns false i want to navigate the page to signIn page. I implemented this in main.dart:</p>
  <pre><code>Future&lt;void&gt; main()async(){
  WidgetsFlutterBinding.ensureInitialized(); 
  AcadFlip myApp;
  if(db.checkDb() ){
         myApp = AcadFlip(
        initialRoute: '/SignIn');
      }
  return runApp(myApp);
  }
  
  class AcadFlip extends StatelessWidget {
  
    final String initialRoute;
  
    AcadFlip({this.initialRoute});
      
    
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
          initialRoute:initialRoute,
          routes: routes,
      );
    }
  }
  </code></pre>
  <p>How to make the function checkdb() display or return boolean rather than <code>Future&lt;dynamic&gt;</code> instance for the navigation?</p>