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.
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.
Copy to Clipboard
_initDatabase() async {
...
String dbPath = join(dataDirectory.path, _databaseName);
print('db location : '+dbPath);
...
}
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.
#flutter #flutter article #how to query sqlite db in flutter #view database in flutter app #view sqlite db in flutter app