createDatabase abstract method

Future<bool> createDatabase(
  1. String name, {
  2. Map<String, Object?>? options,
})

Creates a new database with the given name.

Options are driver-specific:

  • MySQL: {charset: 'utf8mb4', collation: 'utf8mb4_unicode_ci'}
  • Postgres: {encoding: 'UTF8', owner: 'username', template: 'template0', locale: 'en_US.UTF-8', lc_collate: 'en_US.UTF-8', lc_ctype: 'en_US.UTF-8', tablespace: 'pg_default', connection_limit: -1}
  • SQLite: (no options - file-based)

Returns true if created, false if already exists. Throws DriverException on error.

Implementation

Future<bool> createDatabase(String name, {Map<String, Object?>? options});