-
-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DatabaseException(database_closed 1) #1122
Comments
Weird indeed, can you:
|
Thank you very much for the very quick response. I will follow your instructions and get back to you. |
I forgot to specify that when I restart the application, everything works perfectly, the data is saved in the db without any problem. The problem occurs when launching the application for the first time After following your instructions, here is the result :
|
Still weird. It seems here that it is creating the database. When you launch a second time, if should not go through onCreate, correct? Are you still getting the same error the second time you launch the app. Are you deleting the database somewhere?(which could cause the issue as deleting, closes the database). Can you try a simple select right after opening the database? |
I finally solved the problem. I thought about your message a little above and I actually remembered that I used _database.close(), but in "main.dart". I didn't know there was a way to update the database with onUpgrade. So I set up a method to delete the database when starting the app in main.dart so that it could be recreated in "home.dart" with the new database structure. Despite the fact that I used "await async{}" to make tasks completely complete in "main.dart" before accessing "home.dart", the bug originated from there. I really didn't expect it to happen like this. Problem solved! Thank you so much |
Hi Team !
For 3 days I have been facing an error: DatabaseException(database_closed 1).
Please help me!
Here is my code below :
According to my observation, the database is open but when a transaction must be launched, it closes
Please help me!
The text was updated successfully, but these errors were encountered: