Search code examples
sqliteuser-interfaceflutterdart

Is it possible to get a GUI for an SQLite database created in flutter for android simulator?


I created a database main.db in flutter, located at the ApplicationDocumentsDirectory.path. This worked without any problem.

But for easier maintanance and not always having to create an SQL-Statement to see the data or structure I'd like to get a GUI to watch the database. First I wanted to use Browser DB for SQLite but I don't know where the database is saved on my notebook, if so. Also I can't find it with Agent Ransack either.

Is there a way to find the database or maybe an easier way to see the database on a GUI?
I use Visual Studio Code for development if that's any help.


Solution

  • For Android, the easiest way I have found is to just have Android Studio installed on my machine as well. In Android Studio you can view the database on the device via Device File Explorer

    View > Tool Windows > Device File Explorer.
    

    In the new tab make sure your device is selected e.g

    MyAndroidDevice > data > data >com.myflutterapp
    

    Here you will find your Flutter application files, the main database will be located inside the 'app_flutter folder'.

    Once you've located the database file, right click and save as. You can then open this db file with BrowserDB or sqlitebrowser.

    There might be a similar way to do it with Xcode as well, but I'm not so familiar with that particular IDE.