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.

_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.

View SQLite DB physical location

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 sdkpath. sdk path will be shown in android studio > sdk manager.

#flutter #view database in flutter app

View SQLite DB in Flutter Application
91.85 GEEK