3

I'm creating on my own a to-do app using Flutter. When I compile and try to insert a data in sqlite database, I got this error Flutter Sqlite Exception,No such table task, SQL logic Error.

Note: I use moor_ffi, moor ,and generate the database.g.dart file using command flutter packages pub run build_runner build.

2 Answers 2

11

From moor documentation:

Why am I getting no such table errors?

If you add another table after your app has already been installed, you need to write a migration that covers creating that table. If you’re in the process of developing your app and want to use un- and reinstall your app instead of writing migrations, that’s fine too. Please note that your apps data might be backed up on Android, so manually deleting your app’s data instead of a reinstall is necessary on some devices.

So everytime you have modified your database, you need to re-install your app or increase the schema version in your database.

  @override
  int get schemaVersion => 2;
Sign up to request clarification or add additional context in comments.

Comments

0

I got simular error and I did this; I changed database file type

".sqlite" to ".db"

and my problem is solved

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.