databaseFactory top-level property

DatabaseFactory databaseFactory

sqflite Default factory

Implementation

DatabaseFactory get databaseFactory => sqfliteDatabaseFactory;
void databaseFactory=(DatabaseFactory databaseFactory)

Change the default factory.

Be aware of the potential side effect. Any library using sqflite will have this factory as the default for all operations.

This setter must be call only once, before any other calls to sqflite.

Implementation

set databaseFactory(DatabaseFactory databaseFactory) {
  // Warn when changing. might throw in the future
  if (databaseFactory != null) {
    if (!(databaseFactory is SqfliteDatabaseFactory)) {
      throw ArgumentError.value(
          databaseFactory, 'databaseFactory', 'Unsupported sqflite factory');
    }
    if (_databaseFactory != null) {
      stderr.writeln('''
*** sqflite warning ***

You are changing sqflite default factory.
Be aware of the potential side effects. Any library using sqflite
will have this factory as the default for all operations.

*** sqflite warning ***
''');
    }
    sqfliteDatabaseFactory = databaseFactory as SqfliteDatabaseFactory;
  } else {
    /// Will use the plugin sqflite factory
    sqfliteDatabaseFactory = null;
  }
}