Open haashem opened 2 weeks ago
sqflite on iOS and Android uses whatever SQLite bundled on the platform. It seems the UPSERT (ON CONFLICT) feature was added in SQLite 3.24 which might not be present in some Android version: See
You can do a "SELECT sqlite_version()" to check the version.
I see 2 solutions:
sqflite_common_ffi
along with sqlite3
and sqlite3 flutter libs. I have not tried it much but it should workForget that, I see the report is on Android 14 which should be fine. Parallel writes should be fine. sqflite serializes calls anyway. Still puzzled...my only "feeling" would be not to use the cache directory but instead use getDatabasesPath on Android and manage on your side to not make it too big. I don't know what is the Android behavior as when the cache is cleared (low storage situation, mabye your database is very big) but indeed if Android decides to delete the files, the error reported might happen. One alternative solution would be to catch this error and re-open the database when it happens. I'll try later (not very soon) to reproduce the issue by filling a db on the cache or by forcing file deletion but so far sqlite does not provide any automatic mechanism to handle this issue.
Hi,
I use sqflite to cache network responses, and delete the expired caches weekly. After publishing the app, I got below crash reports in Firebase for some Android devices:
Here is how I create the db:
I don't delete the db file after creation.
Do you think it can be result of parallel writes in the same table?