fromJson static method
Implementation
static Variable fromJson(Map<String, dynamic> json) {
final type = EnumToString.fromString(
VariableTypes.values,
json['type'],
);
switch (type) {
case VariableTypes.color:
return ColorVariable.fromJson(json);
case VariableTypes.json:
return JsonVar.fromJson(json);
case VariableTypes.int:
return IntVar.fromJson(json);
case VariableTypes.double:
return DoubleVar.fromJson(json);
case VariableTypes.text:
return StringVar.fromJson(json);
case VariableTypes.bool:
return BoolVar.fromJson(json);
case VariableTypes.datetime:
return DateTimeVar.fromJson(json);
case VariableTypes.enumed:
return EnumVar.fromJson(json);
case VariableTypes.googleMapsController:
return GoogleMapsControllerVariable.fromJson(json);
case VariableTypes.pageViewController:
return PageViewControllerVariable.fromJson(json);
case VariableTypes.model:
return ModelVar.fromJson(json);
case VariableTypes.textList:
return StringListVar.fromJson(json);
case VariableTypes.boolList:
return BoolListVar.fromJson(json);
case VariableTypes.datetimeList:
return DateTimeListVar.fromJson(json);
case VariableTypes.doubleList:
return DoubleListVar.fromJson(json);
case VariableTypes.intList:
return IntListVar.fromJson(json);
case VariableTypes.modelList:
return ModelListVar.fromJson(json);
case VariableTypes.deviceInfo:
return DeviceInfoControllerVariable.fromJson(json);
case VariableTypes.reference:
return ReferenceVariable.fromJson(json);
default:
throw Exception('Unknown variable type, type: $type');
}
}