openDatabase abstract method

  1. @override
Future<Database> openDatabase(
  1. String path, {
  2. OpenDatabaseOptions? options,
})
inherited

Open a database at path with the given OpenDatabaseOptionsoptions

  var databasesPath = await getDatabasesPath();
  String path = join(databasesPath, 'demo.db');
  Database database = await openDatabase(path, version: 1,
      onCreate: (Database db, int version) async {
    // When creating the db, create the table
    await db.execute(
        'CREATE TABLE Test (id INTEGER PRIMARY KEY, name TEXT, value INTEGER, num REAL)');
  });

Notice, join is a part of the path package

Implementation

@override
Future<Database> openDatabase(String path, {OpenDatabaseOptions? options});