I have a problem function of Inserted => The return type 'Null' isn't a 'Future<_>', as required by the closure's context
CodePudding user response:
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.
CodePudding user response:
If function use async-await then you have to use Future
Future<void>
-> function is future and return null
Future<String>
-> function is future and return String
as output
In above you can replace Future<_>
by the return type you expect.
I think you have to return int, it will help to know on which row CRUD operation is performed