Update an (native) android app with a new version in Flutter while keeping the database

475

If anyone needed it, I was able to read the data from the existing database and write to it using flutter.

My previous test had gone wrong because the bases were allocated in separate directories.

In java, I had created the database using the SQLiteOpenHelper class, while in the new flutter application I tried to connect using getApplicationDocumentsDirectory().

I just changed the access path, and it's all settled :)

var databasesPath = await getDatabasesPath (); String path = join (databasesPath, "database.db");

Share:
475
tbruning
Author by

tbruning

Updated on December 06, 2022

Comments

  • tbruning
    tbruning over 1 year

    I have a small application for android written in java, I am rewriting using flutter.

    Is it possible to transition to the new version by keeping the SQLite database structure intact, including all data?

    I ran a test, and although I was able to overwrite the application, the data was lost after upgrade.