setDefaultSource method

  1. @ControllerProps(NodeProps.kDefaultSource)
void setDefaultSource(
  1. ImageRenderViewModel renderViewModel,
  2. String defaultSource
)

Implementation

@ControllerProps(NodeProps.kDefaultSource)
void setDefaultSource(ImageRenderViewModel renderViewModel, String defaultSource) {
  if (defaultSource.startsWith('data:image/')) {
    var bytesImage = const Base64Decoder().convert(defaultSource.split('base64,').last);
    renderViewModel.defaultImage = Image.memory(bytesImage);
  } else {
    LogUtils.w('ImageController', "setDefaultSource error, defaultSource must be base64");
  }
}