fluttertypes

Future isn't a type. Try correcting the name to match an existing type.dartnot_a_type


Future isn't a type. Try correcting the name to match an existing type.dartnot_a_type

I was using sqflite in flutter, here is my code to insert the value into table, where I am getting this error:

Future<List<Map<String,dynamic>>> getNoteMapList() async {
    Database db = await this.database;
    var result = await db.query(noteTable, orderBy: '$colPriority ASC');
    return result;
}

Solution

  • Please try to check your code first. 👌🏽

    There's a fairly high probability that you have an extra chevron > somewhere in your code 😬 (in that file, but not necessarily on the same line)

    something like

    Future<Type>> // Notice the extra `>` 🤦🏽‍♂️
    

    ...and that tricks the linter to believe Future is probably a method or something.

    The local scope of Future in this case takes precedence over whatever is in dart:async, so an import might not help.


    Probable solution: Look for a trailing > and eliminate it.

    like

    Future<Type> // Extra `>` removed 💪🏽
    

    If you can't find a trailing >, you've probably got a different issue from what I just described.

    Good luck debugging your issue 🍀