Search code examples
javascriptandroidflutterdartsqflite

flutter with Sqflite : The return type 'Null' isn't a 'Future<_>', as required by the closure's context


I have a problem function of Inserted => The return type 'Null' isn't a 'Future<_>', as required by the closure's context

enter image description here


Solution

  • You have to add async to your function.

    await database.transaction((txn) async { });
    

    I would also replace then / catchError inside the function with await and try/catch.