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 114 times
-1
Yeasin Sheikh
- 16,243
- 4
- 15
- 37
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
- 894
- 1
- 7
- 13
leenz
- 1
- 1
https://stackoverflow.com/a/54097327/3596519 – Masoud Jan 16 '22 at 09:36