fromConfig static method
FutureOr<DBObjectDirectoryAdapter>
fromConfig(
- Map<
String, dynamic> ? config, { - EntityRepositoryProvider? parentRepositoryProvider,
- String? workingPath,
Implementation
static FutureOr<DBObjectDirectoryAdapter> fromConfig(
Map<String, dynamic>? config,
{EntityRepositoryProvider? parentRepositoryProvider,
String? workingPath}) {
boot();
var directoryPath = config?['path'] ?? config?['directory'];
if (directoryPath == null) {
throw ArgumentError("Config without `path` entry!");
}
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 directory = Directory(directoryPath);
var adapter = DBObjectDirectoryAdapter(
directory,
parentRepositoryProvider: parentRepositoryProvider,
generateTables: generateTables,
populateTables: populateTables,
populateSource: populateSource,
populateSourceVariables: populateSourceVariables,
workingPath: workingPath,
);
return adapter;
}