realize method

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

Builds a live component from spec, or returns null when it cannot be realized in the given context (for example a mesh with no resource realizer).

Implementation

@override
Component? realize(ComponentSpec spec, RealizeContext context) {
  final props = PropertyReader(spec, this, context);
  final component = create(props);
  for (final field in resolvedFields) {
    final write = field.write;
    if (write == null) continue;
    final value = props.value(field.def.name);
    if (value == null) continue;
    write(component, value, context);
  }
  return component;
}