fromJson static method

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

Implementation

static ConditionParameter fromJson(Map<String, dynamic> json) {
  final type =
      EnumToString.fromString(ConditionParameterTypes.values, json['type']);
  switch (type) {
    case ConditionParameterTypes.text:
      return ConditionParameterText.fromJson(json);
    case ConditionParameterTypes.int:
      return ConditionParameterInt.fromJson(json);
    case ConditionParameterTypes.double:
      return ConditionParameterDouble.fromJson(json);
    case ConditionParameterTypes.bool:
      return ConditionParameterBool.fromJson(json);
    case ConditionParameterTypes.json:
      return ConditionParameterJson.fromJson(json);
    case ConditionParameterTypes.cubitVariable:
      return ConditionParameterCubitVariable.fromJson(json);
    case ConditionParameterTypes.cubitState:
      return ConditionParameterCubitState.fromJson(json);
    case ConditionParameterTypes.jsonGetAttribute:
      return ConditionParameterJsonGetAttribute.fromJson(json);
    case ConditionParameterTypes.deviceInfo:
      return ConditionParameterDeviceInfo.fromJson(json);
    case ConditionParameterTypes.currentValue:
      return ConditionParameterCurrentValue.fromJson(json);
    case ConditionParameterTypes.currentCubitState:
      return ConditionParameterCurrentCubitState.fromJson(json);
    case ConditionParameterTypes.parameter:
      return ConditionParameterComponentParameter.fromJson(json);
    default:
      throw Exception(
          'ConditionParameter, unknown condition parameter type, type: $type');
  }
}