title: SQLite connections returns null in Flutter
body: <p>I am using SQFLite flutter package in my app. However, I keep getting null as a result of the connection to the DB. Below is my code used in initializing DB, creating table, and methods for adding items and fetching them:</p>
  
  <pre><code>  import 'package:sqflite/sqflite.dart';
    import 'package:path_provider/path_provider.dart';
    import 'dart:io';
    import 'package:path/path.dart';
    import 'dart:async';
  
    class StoreDBProvider {
  
         Database db;
  
         init() async {
            Directory documentsDirectory = await 
            getApplicationDocumentsDirectory();
            final path = join(documentsDirectory.path, "carts.db");
            db = await openDatabase(
                 path,
                 version: 3,
                 onCreate: (Database newDB, int version){
                       newDB.execute('CREATE TABLE Cart (id INTEGER 
                                  PRIMARY KEY, name TEXT, price DOUBLE, image TEXT, rating DOUBLE)');
                 }
                 );
                 return db;
          }
  
  
          Future&lt;dynamic&gt; fetchItem(int id) async {
               print("DB CONNECTION IS: $db");
  
               final maps = await db.query(
                            "Cart",
                            columns: null,
                            where: "id = ?",
                            whereArgs: [id],
               );
  
               print(maps);
  
               if(maps.length &gt; 0){
                   print("Data exists");
                   return maps.first;
               }
  
               return null;
          }
  
  
          Future&lt;int&gt; addItem(item) async{
               return db.insert("Cart", item);
          }
  }  
  </code></pre>
  
  <p>After some debuggin, I notice that "db" value is null.  Here is the error message: </p>
  
  <pre><code> E/flutter ( 6921): [ERROR:flutter/shell/common/shell.cc(182)] Dart 
   Error: Unhandled exception:
   E/flutter ( 6921): NoSuchMethodError: The method 'insert' was called on null.
   E/flutter ( 6921): Receiver: null
   E/flutter ( 6921): Tried calling: insert("Cart", _LinkedHashMap len:5)
   E/flutter ( 6921): #0      Object.noSuchMethod 
   (dart:core/runtime/libobject_patch.dart:50:5)
   E/flutter ( 6921): #1      StoreDBProvider.addItem 
  </code></pre>
  
  <p>(file:///Users/Oluwashola/workspace/fashion_style/lib/src/resources/store_db_provider.dart:46:15)</p>
  
  <p>Please, any assistance here is appreciated. Thank you.</p>