db property

Future<Database> get db

Opens (or returns the already opened) application database.

The database name is read from a small text file stored at <databasesPath>/dbName. If the file does not exist, the default name sqlf_easy.db is used. The file is created/updated by changeDB. Concurrent first calls share one opening.

On Windows and Linux the base lives in the application support folder; a base left by 2.0.3 under the current directory is found and kept where it is.

Implementation

Future<Database> get db async {
  final Database? database = (await _open()).database;
  if (database == null) {
    throw UnsupportedError(
      'DataAccess.db is not available in a browser: use the DataAccess methods.',
    );
  }
  return database;
}