fromJson static method

DesignSystem fromJson(
  1. Object? json
)

One bundle: {"manifest": {...}, "design": "...", "patterns": "...", "components": {"Button": {...document...}}}, the form a design system is published and shipped as an asset in.

Implementation

static DesignSystem fromJson(Object? json) {
  final m = readMap(json) ?? const {};
  final docs = readMap(m['components']) ?? const {};
  return DesignSystem(
    manifest: DesignSystemManifest.fromJson(m['manifest']),
    design: readString(m['design']) ?? '',
    patterns: readString(m['patterns']) ?? '',
    components: ComponentLibrary.of([
      for (final d in docs.values)
        if (readMap(d) != null) LayoutDocument.fromJson(d),
    ]),
  );
}