open static method

SqliteDatabase open(
  1. String atSign,
  2. String dbPath
)

Opens (creating parent directories and the file if needed) the database at dbPath, applies SqliteSchema, and returns the context.

Implementation

static SqliteDatabase open(String atSign, String dbPath) {
  _configureLibrary();
  final dir = p.dirname(dbPath);
  if (dir.isNotEmpty) {
    Directory(dir).createSync(recursive: true);
  }
  final db = sqlite3.open(dbPath);
  try {
    SqliteSchema.apply(db);
  } catch (_) {
    db.dispose();
    rethrow;
  }
  return SqliteDatabase._(atSign, dbPath, db);
}