title: Null Check operator used on a null value on flutter with Sqflite
body: <p>I'm studying flutter with Sqflite and trying to make a small app, but I'm getting this error when I run the code, I've looked literaly everywhere to findout what it could be.</p>
  <p>Here the code code who use the Sqflite package:</p>
  <pre><code>    Future&lt;Database&gt; getDatabase() async {
        final String path = join(await getDatabasesPath(), 'bytebank.db');
        return openDatabase(path, onCreate: (db, version) {
          db.execute('CREATE TABLE contacts'
              '(id INTEGER PRIMARY KEY, '
              'name TEXT, '
              'account_number INTEGER)');
        }, version: 1);
      }
      
      Future&lt;int&gt; save(Contact contact) async {
        final Database db = await getDatabase();
        final Map&lt;String, dynamic&gt; contactMap = Map();
        contactMap['name'] = contact.name;
        contactMap['account_number'] = contact.account;
        contactMap['id'] = contact.id;
        return db.insert('contacts', contactMap);
      }
      
      Future&lt;List&lt;Contact&gt;&gt; findAll() async {
        final Database db = await getDatabase();
        final List&lt;Map&lt;String, dynamic&gt;&gt; result = await db.query('contacts');
        final List&lt;Contact&gt; contacts = [];
        for (Map&lt;String, dynamic&gt; row in result) {
          final Contact contact = Contact(
            row['id'],
            row['name'],
            row['account_number'],
          );
          contacts.add(contact);
        }
        return contacts;
      }
  </code></pre>
  <p>And here is the only one place where I use This functions:</p>
  <pre><code>void main() {
    save(Contact('William', 2, 13456)).then((id) {
    findAll().then((contacts) =&gt; print(contacts));
    });
    runApp(ByteBankApp());
  }
  </code></pre>
  <p>Model Class:</p>
  <pre><code>class Contact {
    final String name;
    final int account;
    final int id;
    Contact( this.id,
      this.name,
      this.account,
  );
  
    @override
    String toString() {
      return 'Contact{name: $name, account: $account}';
    }
  }
  </code></pre>
  <p>Error Trace back:</p>
  <pre><code>Launching lib\main.dart on sdk gphone x86 arm in debug mode...
  Running Gradle task 'assembleDebug'...
  √  Built build\app\outputs\flutter-apk\app-debug.apk.
  Installing build\app\outputs\flutter-apk\app.apk...
  Debug service listening on ws://127.0.0.1:52296/07rtnvW9tlQ=/ws
  Syncing files to device sdk gphone x86 arm...
  E/flutter (28649): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Null check operator used on a null value
  E/flutter (28649): #0      MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:142:86)
  E/flutter (28649): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:148:36)
  E/flutter (28649): #2      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:331:12)
  E/flutter (28649): #3      invokeMethod (package:sqflite/src/sqflite_impl.dart:17:13)
  E/flutter (28649): #4      SqfliteDatabaseFactoryImpl.invokeMethod (package:sqflite/src/factory_impl.dart:82:7)
  E/flutter (28649): #5      SqfliteDatabaseFactoryMixin.safeInvokeMethod.&lt;anonymous closure&gt; (package:sqflite_common/src/factory_mixin.dart:41:38)
  E/flutter (28649): #6      wrapDatabaseException (package:sqflite/src/exception_impl.dart:7:32)
  E/flutter (28649): #7      SqfliteDatabaseFactoryImpl.wrapDatabaseException (package:sqflite/src/factory_impl.dart:78:7)
  E/flutter (28649): #8      SqfliteDatabaseFactoryMixin.safeInvokeMethod (package:sqflite_common/src/factory_mixin.dart:41:7)
  E/flutter (28649): #9      SqfliteDatabaseFactoryMixin.getDatabasesPath (package:sqflite_common/src/factory_mixin.dart:153:26)
  E/flutter (28649): #10     getDatabasesPath (package:sqflite/sqflite.dart:161:54)
  E/flutter (28649): #11     getDatabase (package:bytebank/database/app_database.dart:6:34)
  E/flutter (28649): #12     save (package:bytebank/database/app_database.dart:16:29)
  E/flutter (28649): #13     main (package:bytebank/main.dart:7:3)
  E/flutter (28649): #14     _runMainZoned.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (dart:ui/hooks.dart:142:25)
  E/flutter (28649): #15     _rootRun (dart:async/zone.dart:1354:13)
  E/flutter (28649): #16     _CustomZone.run (dart:async/zone.dart:1258:19)
  E/flutter (28649): #17     _runZoned (dart:async/zone.dart:1789:10)
  E/flutter (28649): #18     runZonedGuarded (dart:async/zone.dart:1777:12)
  E/flutter (28649): #19     _runMainZoned.&lt;anonymous closure&gt; (dart:ui/hooks.dart:138:5)
  E/flutter (28649): #20     _delayEntrypointInvocation.&lt;anonymous closure&gt; (dart:isolate-patch/isolate_patch.dart:283:19)
  E/flutter (28649): #21     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
  E/flutter (28649): 
  </code></pre>