setData method
Implementation
Variable setData(
Variable variable,
dynamic value, {
String? modelID,
String? enumValue,
}) {
switch (variable.runtimeType) {
case StringVar:
return (variable as StringVar).copyWith(data: value);
case StringListVar:
return (variable as StringListVar).copyWith(data: value);
case IntVar:
return (variable as IntVar).copyWith(data: value);
case IntListVar:
return (variable as IntListVar).copyWith(data: value);
case DoubleVar:
return (variable as DoubleVar).copyWith(data: value);
case DoubleListVar:
return (variable as DoubleListVar).copyWith(data: value);
case BoolVar:
return (variable as BoolVar).copyWith(data: value);
case BoolListVar:
return (variable as BoolListVar).copyWith(data: value);
case JsonVar:
return (variable as JsonVar).copyWith(data: value);
case EnumVar:
return (variable as EnumVar).copyWith(
values: value,
value: enumValue,
);
case DateTimeVar:
return (variable as DateTimeVar).copyWith(data: value);
case DateTimeListVar:
return (variable as DateTimeListVar).copyWith(data: value);
case ModelVar:
return (variable as ModelVar).copyWith(
model: value,
modelID: modelID,
);
case ModelListVar:
return (variable as ModelListVar).copyWith(
models: value,
modelID: modelID,
);
default:
return variable;
}
}