load static method
Implementation
static AdapterConfig load(String? configPath) {
if (configPath == null) return const AdapterConfig();
final file = File(configPath);
if (!file.existsSync()) {
throw AdapterException(['Konfigurationsdatei nicht gefunden: $configPath']);
}
final Object? raw;
try {
raw = jsonDecode(file.readAsStringSync());
} on FormatException catch (e) {
throw AdapterException(['Ungültiges JSON in $configPath: ${e.message}']);
}
if (raw is! Map<String, Object?>) {
throw AdapterException(['$configPath: erwartet ein JSON-Objekt.']);
}
return AdapterConfig(
deriveFrom: _stringList(raw, 'deriveFrom', configPath) ??
const ['go_router', 'auto_route'],
include: _stringList(raw, 'include', configPath) ?? const ['lib/**'],
fromBuilder: _boolValue(raw, 'fromBuilder', configPath) ?? false,
);
}