title: How can I fix "Future isn't a type" error in flutter?
body: <p>I'm trying to store app data of my flutter application in the database, but the complier keeps showing &quot;Future isn't a type&quot; for async func and underlines in red. I've tried removing .analysis-driver as well, but that doesn't help.
  How can I fix it ?</p>
  <p>Code:</p>
  <pre><code>import 'package:sqflite/sqflite.dart';
  import 'package:path_provider/path_provider.dart';
  import 'package:path/path.dart';
  import 'dart:io';
  
  class Db_Help{
  
    static final _db_name=&quot;Work_tasks.db&quot;;
    static final _db_version=1;
    static final table=&quot;Work Table&quot;;
  
    static final task_id=&quot;ID&quot;;
    static final task=&quot;Task&quot;;
    static final bool_check=&quot;Value&quot;;
  
    static Database _database;
  
    Db_Help._private_cons();
    static final Db_Help instance=Db_Help._private_cons();
  
    _initDatabase() async{
      Directory docu_dir=await getApplicationDocumentsDirectory();
      String path=join(docu_dir.path,_db_name);
  
      return await openDatabase(path, version: _db_version, onCreate: _onCreate);
    }
  
    Future&lt;Database&gt; get database async{
  
      if(_database!=null)
        return _database;
  
      _database=await _initDatabase();
      return _database;
  
    }
  
    Future _onCreate(Database db, int version) async{
      await db.execute('''
      CREATE TABLE $table (
      $task_id INTEGER PRIMARY KEY,
      $task TEXT NOT NULL,
      $bool_check INTEGER)
      ''');
    }
  
    Future&lt;int&gt; insert(Map&lt;String,dynamic&gt; row) async{
      Database db= await instance.database;
      return await db.insert(table, row);
    }
  
   }
  </code></pre>