I have a problem function of Inserted => The return type 'Null' isn't a 'Future<_>', as required by the closure's context
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.