As a newbie flutter developer, my code to create database is following
import 'dart:async';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
Future<Database> getDB() async {
var dbPath = await getDatabasesPath();
print("dbPath => $dbPath");
final Future<Database> database = openDatabase(
// Set the path to the database. Note: Using the `join` function from the
// `path` package is best practice to ensure the path is correctly
// constructed for each platform.
join(dbPath, 'doggie_database.db'),
// When the database is first created, create a table to store dogs.
onCreate: (db, version) {
// Run the CREATE TABLE statement on the database.
return db.execute(
'CREATE TABLE dogs(id INTEGER PRIMARY KEY, name TEXT, age INTEGER)',
);
},
// Set the version. This executes the onCreate function and provides a
// path to perform database upgrades and downgrades.
version: 1,
);
return database;
}
I am able to connect to this database and it seems the values insert as well. However, I would like to be able to connect to this database using tools such as DBeaver or DataGrip. Now, since this database is in the emulator storage, I am not able to connect any of these tools to browser data.
I have create the demo of how I figured all of this. You can watch it on YouTube
My questions are
- Can I connect database tools such as DBeaver or DataGrip with storage inside emulator?
- Can I create database outside of emulator so that I can connect tools such as DBeaver or DataGrip and work with data easily?
Please let me know Thank you