fromConfig static method

FutureOr<DBObjectMemoryAdapter> fromConfig(
  1. Map<String, dynamic>? config, {
  2. EntityRepositoryProvider? parentRepositoryProvider,
  3. String? workingPath,
})

Implementation

static FutureOr<DBObjectMemoryAdapter> fromConfig(
    Map<String, dynamic>? config,
    {EntityRepositoryProvider? parentRepositoryProvider,
    String? workingPath}) {
  boot();

  var populate = config?['populate'];

  var generateTables = false;
  Object? populateTables;
  Object? populateSource;
  Object? populateSourceVariables;

  if (populate is Map) {
    generateTables = populate.getAsBool('generateTables', ignoreCase: true) ??
        populate.getAsBool('generate-tables', ignoreCase: true) ??
        populate.getAsBool('generate_tables', ignoreCase: true) ??
        false;

    populateTables = populate['tables'];
    populateSource = populate['source'];
    populateSourceVariables = populate['variables'];
  }

  var adapter = DBObjectMemoryAdapter(
    parentRepositoryProvider: parentRepositoryProvider,
    generateTables: generateTables,
    populateTables: populateTables,
    populateSource: populateSource,
    populateSourceVariables: populateSourceVariables,
    workingPath: workingPath,
  );

  return adapter;
}