exportConfig method
Export configuration to a JSON or YAML string.
Only JSON is implemented; YAML support is a future extension.
Implementation
String exportConfig({ConfigScope? scope, String format = 'json'}) {
final data = scope != null ? _store[scope]! : getAll();
// Strip sensitive keys.
final safe = Map<String, dynamic>.from(data);
safe.remove(ConfigKeys.apiKey);
if (format == 'json') {
return const JsonEncoder.withIndent(' ').convert(safe);
}
// Fallback to JSON for unsupported formats.
return const JsonEncoder.withIndent(' ').convert(safe);
}