Future insertToDatabase({
required String title,
required String data,
required String time,
}) async {
return await database.transaction((txn) {
txn
.rawInsert(
'INSERT INTO tasks(title, date, time, status) VALUES("$title","$data","$time","new")')
.then((value) {
print('$value inserted Done !!');
}).catchError((err) {
print('error insert to tables ${err.toString()}');
});
return null;
});
}
Asked
Active
Viewed 510 times
-1

Md. Yeasin Sheikh
- 54,221
- 7
- 29
- 56
1 Answers
0
i have the same problem till now
insertToDatabase({
required String title,
required String time,
required String date,
}) async {
await database?.transaction((txn) {
txn
.rawInsert(
'INSERT INTO tasks (title , date , time , status) VALUES ("$title $time" , "$date" , "new")')
.then((value) {
print('$value inserted successfully');
emit(AppInsertDatabaseState());
getDataFromDatabase(database);
}).catchError((error) {
print('Error When Inserting new Records ${error.toString()}');
});
//throw Exception('Result unexpectedly null');
print(null!);

Mohit Kushwaha
- 1,003
- 1
- 10
- 15

leenz
- 1
- 1
https://stackoverflow.com/a/54097327/3596519 – Masoud Jan 16 '22 at 09:36