Closed mhndda closed 6 months ago
Hard to say what is going wrong, can you confirm that data is empty after the insert (print(await db.query('CREDS
)). Personnally I would do this in a transaction:
await db.transaction((txn) async {
await txn.delete('CREDS');
final data = {'username': username, 'password': password};
await txn.insert('CREDS', data);
// Tmp quick check
print(await txn.query('CREDS'));
});
Thank you so much, it worked now :)
in the following code, I am trying to clear the CREDS table before adding one new row just to make sure there is only one record in the table, the queries seems to work fine (no error is showing up) but when I restart the app the data is missing, but when I remove the DELETE statement it works fine and the data shows up fine( in another function).
Code:
I tried with batch and commit, still have the same result. Sorry if repeated or misleading I just couldn't find help or answer anywhere else.