fromJson static method

ComponentParameterValue fromJson(
  1. Map<String, dynamic> json
)

Implementation

static ComponentParameterValue fromJson(Map<String, dynamic> json) {
  final type = EnumToString.fromString(
    ModelParameterTypes.values,
    json['type'],
  );
  if (type == ModelParameterTypes.staticColor) {
    return ColorComponentParameterValue.fromJson(json);
  }
  if (type == ModelParameterTypes.staticText) {
    return TextComponentParameterValue.fromJson(json);
  }
  if (type == ModelParameterTypes.staticJson) {
    return JsonComponentParameterValue.fromJson(json);
  }
  if (type == ModelParameterTypes.staticInt) {
    return IntComponentParameterValue.fromJson(json);
  }
  if (type == ModelParameterTypes.staticDouble) {
    return DoubleComponentParameterValue.fromJson(json);
  }
  if (type == ModelParameterTypes.variable) {
    return VariableComponentParameterValue.fromJson(json);
  }
  if (type == ModelParameterTypes.jsonGetAttribute) {
    return JsonGetAttributeComponentParameterValue.fromJson(json);
  }
  throw Exception('Unknown component parameter type');
}