when<_T> method
_T
when<_T>({
- required _T string(),
- required _T num(),
- required _T date(),
- required _T duration(),
- required _T list(),
- required _T map(),
- required _T set(),
Implementation
_T when<_T>({
required _T Function(ValidaString) string,
required _T Function(ValidaNum) num,
required _T Function(ValidaDate) date,
required _T Function(ValidaDuration) duration,
required _T Function(ValidaList) list,
required _T Function(ValidaMap) map,
required _T Function(ValidaSet) set,
}) {
switch (variantType) {
case ValidaFieldType.string:
return string(this as ValidaString);
case ValidaFieldType.num:
return num(this as ValidaNum);
case ValidaFieldType.date:
return date(this as ValidaDate);
case ValidaFieldType.duration:
return duration(this as ValidaDuration);
case ValidaFieldType.list:
return list(this as ValidaList);
case ValidaFieldType.map:
return map(this as ValidaMap);
case ValidaFieldType.set:
return set(this as ValidaSet);
}
}