In this small article, I’ll show you how you can see the data in SQLite DB of your flutter application. In the previous two articles, we’ve covered SQLite CRUD Operation in Flutter App.
Credit to Stack Overflow answer here.
Where is Databases are stored ?
When you create an SQLite DB programmically, did you thought about physically location of the DB? If you are coming from web development, you might look into project explorer for a file with the extension ‘db’. But it’s not in the project directory.
It depends on the environment – android or IOS. To find the location of the database we’ve used a package path_provider in previous article. The db will be stored somewhere in the emulator. To see the path I’ve added the print statement in _initDatabase method of DatabaseHelper class.
Now to see the printed output, If you are on VS Code, open Debug Console ( from view menu ). In my case it prints as follows.
Connect to the SQLite DB
Now connect to the emulator throughadbcommands. As per android.developer, It a command-line tool, that let’s you communicate with a device/ emulator. this tool will be there inside platform-tools folder in your android sdk path. sdk path will be shown in android studio > sdk manager.
Now navigate inside the sdk location and then inside the platform-tools folder. where you could see adb.exe. Execute following command from command prompt.
Now find your package name. It’s there in AndroidManifest.xml(https://m2c6a4u3.stackpathcdn.com/android/app/src/main/AndroidManifest.xml) file as package name.
Now run as the package. from the previous command prompt.
Hope you find this helpful. End.
Step By Step Video Tutorial