fromJson static method

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

Implementation

static VariablesAction fromJson(Map<String, dynamic> json) {
  final type = EnumToString.fromString(
          AssignVariableActionTypes.values, json['assign_from_type']) ??
      AssignVariableActionTypes.valueFromElement;
  switch (type) {
    case AssignVariableActionTypes.valueFromElement:
      return AssingVariableFromElement.fromJson(json);
    case AssignVariableActionTypes.valueFromVariable:
      return AssingVariableFromVariable.fromJson(json);
    case AssignVariableActionTypes.valueFromJson:
      return AssingVariableFromJson.fromJson(json);
    case AssignVariableActionTypes.valueFromStaticText:
      return AssingVariableFromStaticTextValue.fromJson(json);
    case AssignVariableActionTypes.valueFromStaticInt:
      return AssingVariableFromStaticIntValue.fromJson(json);
    case AssignVariableActionTypes.valueFromStaticDouble:
      return AssingVariableFromStaticDoubleValue.fromJson(json);
    case AssignVariableActionTypes.valueFromStaticBool:
      return AssingVariableFromStaticBoolValue.fromJson(json);
    case AssignVariableActionTypes.valueFromStaticDateTime:
      return AssingVariableFromStaticDateTimeValue.fromJson(json);
    case AssignVariableActionTypes.valueFromStaticJson:
      return AssingVariableFromStaticJsonValue.fromJson(json);
    default:
      throw Exception(
          'AssignVariableAction, Unknown action type, type: $type');
  }
}