OptionConstraint constructor
OptionConstraint({
- required ConstraintType type,
- Object? min,
- Object? max,
- Object? quant,
- Object? list,
Implementation
OptionConstraint({
required ConstraintType type,
Object? min,
Object? max,
Object? quant,
Object? list,
}) : _wrapped = $js.OptionConstraint(
type: type.toJS,
min: switch (min) {
int() => min.jsify()!,
double() => min.jsify()!,
null => null,
_ => throw UnsupportedError(
'Received type: ${min.runtimeType}. Supported types are: int, double')
},
max: switch (max) {
int() => max.jsify()!,
double() => max.jsify()!,
null => null,
_ => throw UnsupportedError(
'Received type: ${max.runtimeType}. Supported types are: int, double')
},
quant: switch (quant) {
int() => quant.jsify()!,
double() => quant.jsify()!,
null => null,
_ => throw UnsupportedError(
'Received type: ${quant.runtimeType}. Supported types are: int, double')
},
list: switch (list) {
List<double>() => list.toJSArray((e) => e),
List<int>() => list.toJSArray((e) => e),
List() => list.toJSArrayString(),
null => null,
_ => throw UnsupportedError(
'Received type: ${list.runtimeType}. Supported types are: List<double>, List<int>, List<String>')
},
);