toYamlSection method
Renders the configuration as the ai: section of distribution.yaml.
apiKey is written only when given. Pass a ${{VAR}} placeholder to keep
the secret out of version control while still overriding the machine-wide
store, or a literal value when the file is known not to be committed.
Implementation
Map<String, dynamic> toYamlSection({String? apiKey}) => {
'provider': provider.name,
'base-url': baseUrl,
'model': model,
'permission': permission.name,
if (apiKey != null && apiKey.isNotEmpty) 'api-key': apiKey,
};