setSource method

  1. @ControllerProps(NodeProps.kSource)
void setSource(
  1. ImageRenderViewModel renderViewModel,
  2. VoltronArray? source
)

Implementation

@ControllerProps(NodeProps.kSource)
void setSource(ImageRenderViewModel renderViewModel, VoltronArray? source) {
  if (source == null || source.size() == 0) return;
  VoltronMap? firstObj = source.get<VoltronMap>(0);
  String? src = firstObj?.get<String>('uri');
  if (src != null) {
    src = renderViewModel.context.convertRelativePath(renderViewModel.rootId, src);
    if (src != renderViewModel.src) {
      renderViewModel.src = src;
    }
  }
}