componentFiles method
The files that store the component type in this design system's
folder, by reference relative to the manifest: its definition and the
manifest that lists it. A host writes them where it keeps the system
(a folder, a bucket); a system loaded from there afterwards has the
component. Null when it has no such component.
Implementation
Map<String, String>? componentFiles(String type) {
final definition = components[type];
if (definition == null) return null;
const pretty = JsonEncoder.withIndent(' ');
final ref = manifest.components.firstWhere((r) => _stem(r) == type, orElse: () => componentRef(type));
return {
ref: '${pretty.convert(definition.toJson())}\n',
DesignSystemManifest.fileName: '${pretty.convert(withComponent(definition).manifest.toJson())}\n',
};
}