SqliteConnection.open constructor

SqliteConnection.open(
  1. String path
)

Opens (creating if needed) the database file at path.

Implementation

factory SqliteConnection.open(String path) {
  try {
    final db = sq.sqlite3.open(path)..execute('pragma foreign_keys = on');
    return SqliteConnection._(db);
  } catch (e) {
    throw ConnectionException(
      "Cannot open SQLite database '$path': $e",
      cause: e,
    );
  }
}