title: Initialized database still returns as null [Flutter, sqflite]
body: <p>I'm trying to perform CRUD operations on Flutter, using the sqflite library. Online resources point towards a bunch of ways to go about this. Here is my implementation:</p>
  
  <pre><code>class SqlManager { 
   static const String tname = 'table1';
   static const String dname = 'database.db';
   Future&lt;Database&gt; db;
  
   initDB() async {
     Directory path = await getApplicationDocumentsDirectory();
     db = openDatabase(join(path.path, dname), version: 1, onCreate: (db, version) {
       return db.execute(
           'CREATE TABLE $tname (id INTEGER PRIMARY KEY, name TEXT, type TEXT, time1 INTEGER, time2 INTEGER, imp INTEGER, urg INTEGER)');
     });
   }
  
   Future&lt;void&gt; writing(Task task) async {
     print("called");
     final Database DB = await db;
     await DB.insert(
       tname,
       task.toMap(),
       conflictAlgorithm: ConflictAlgorithm.replace,
     );
     print("Execution completed");
   }
  
   Future&lt;List&lt;Task&gt;&gt; reading() async {
     Database DB = await db;
     List&lt;Map&lt;String, dynamic&gt;&gt; maps = await DB.query(tname);
     return List.generate(maps.length, (i) {
       return Task.fromMap(maps[i]);
     });
   }
  } 
  </code></pre>
  
  <p>Whenever I attempt to call any of these functions, I hit upon a NoSuchMethodError, thrown by the variable 'DB' inside one of these functions. Any help is appreciated, thanks!</p>