Is It Possible To Get A Gui For An Sqlite Database Created In Flutter For Android Simulator?
Solution 1:
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.
Solution 2:
There is one beautiful package for db viewer if you are using moor_db
https://pub.dev/packages/moor_db_viewer
Very easy to integrate and very easy to view the tables
Solution 3:
In addition to F-1 answer if you need a more sophisticated tool for manage your database there is the SQLite Studio. You could do the follow steps to achieve this:
To get database (with adb):
adb -s emulator-5554 pull /data/data/com.your.package.yourappname/databases/you_database_name.db .
If you need change it and update (It will override android db)
adb -s emulator-5554 push ~/Desktop/you_database_name.db /data/data/com.your.package.yourappname/databases/
Here is the link to SQLite Studio (works in macOS, linux and windows) https://sqlitestudio.pl/
Solution 4:
Since this is a top google result for browsing a sqlite db in a simulator for flutter devs, for others who stumble upon this, here's a solution for iOS simulators as well:
You need to find your db file first, which for iOS sit under /Users/<youruser>/Library/Developer/CoreSimulator/Devices/
. Assuming you know the db name, you could get the full path like this:
find /Users/<youruser>/Library/Developer/CoreSimulator/Devices/ -name "<name>.db"
For example, using sqflite
's getDatabasesPath()
as the location to create the database, I can see the file sits at /Users/<youruser>/Library/Developer/CoreSimulator/Devices//<devid>/data/Containers/Data/Application/<appid>/Documents/<name>.db
And if you were testing on more than one simulator, you can look up the device id with:
xcrun simctl list # look under "== Devices ==" or grep for "Booted"if it's running
Then browse the db using a tool like DB Browser for SQLite
as suggested earlier if sqlite3
is cumbersome. If using vscode, you could give SQLTools
with its SQLite driver a try.
Post a Comment for "Is It Possible To Get A Gui For An Sqlite Database Created In Flutter For Android Simulator?"