fromConfig<C extends Object, A extends DBRelationalAdapter<C>> static method

FutureOr<A> fromConfig<C extends Object, A extends DBRelationalAdapter<C>>(
  1. Map<String, dynamic> config, {
  2. int minConnections = 1,
  3. int maxConnections = 3,
  4. EntityRepositoryProvider? parentRepositoryProvider,
  5. String? workingPath,
})
override

Implementation

static FutureOr<A>
    fromConfig<C extends Object, A extends DBRelationalAdapter<C>>(
        Map<String, dynamic> config,
        {int minConnections = 1,
        int maxConnections = 3,
        EntityRepositoryProvider? parentRepositoryProvider,
        String? workingPath}) {
  boot();

  var instantiators = getAdapterInstantiatorsFromConfig<C, A>(config);

  if (instantiators.isEmpty) {
    throw StateError(
        "Can't find `$A` instantiator for `config` keys: ${config.keys.toList()}");
  }

  return DBAdapter.instantiateAdaptor<Object, DBRelationalAdapter<Object>>(
          instantiators, config,
          minConnections: minConnections,
          maxConnections: maxConnections,
          parentRepositoryProvider: parentRepositoryProvider,
          workingPath: workingPath)
      .resolveMapped((adapter) => adapter as A);
}