realize method

Component? realize(
  1. ComponentSpec spec,
  2. RealizeContext context
)

Realizes spec into a live component, or returns null when no codec is registered for its type.

Implementation

Component? realize(ComponentSpec spec, RealizeContext context) {
  final component = codecFor(spec.type)?.realize(spec, context);
  if (component != null) {
    final enabled = spec.properties['enabled'];
    if (enabled is BoolValue) component.enabled = enabled.value;
  }
  return component;
}