when<T> method

T when<T>({
  1. required T bool(),
  2. required T int(),
  3. required T num(),
  4. required T str(),
  5. required T option(
    1. SerdeTypeOption
    ),
  6. required T duration(),
  7. required T list(
    1. SerdeTypeList
    ),
  8. required T set(
    1. SerdeTypeSet
    ),
  9. required T map(
    1. SerdeTypeMap
    ),
  10. required T function(),
  11. required T nested(
    1. SerdeTypeNested
    ),
  12. required T union(
    1. SerdeTypeUnion
    ),
  13. required T unionType(
    1. SerdeTypeUnionType
    ),
  14. required T enumV(
    1. SerdeTypeEnum<Object?>
    ),
  15. required T dynamic(),
  16. required T late(
    1. SerdeTypeLate
    ),
})

Implementation

T when<T>({
  required T Function() bool,
  required T Function() int,
  required T Function() num,
  required T Function() str,
  required T Function(SerdeTypeOption) option,
  required T Function() duration,
  required T Function(SerdeTypeList) list,
  required T Function(SerdeTypeSet) set,
  required T Function(SerdeTypeMap) map,
  required T Function() function,
  required T Function(SerdeTypeNested) nested,
  required T Function(SerdeTypeUnion) union,
  required T Function(SerdeTypeUnionType) unionType,
  required T Function(SerdeTypeEnum<Object?>) enumV,
  required T Function() dynamic,
  required T Function(SerdeTypeLate) late,
}) {
  switch (_inner) {
    case 'bool':
      return bool();
    case 'int':
      return int();
    case 'num':
      return num();
    case 'String':
      return str();
    case 'Duration':
      return duration();
    case 'Function':
      return function();
    case 'List':
      return list(this as SerdeTypeList);
    case 'Set':
      return set(this as SerdeTypeSet);
    case 'Map':
      return map(this as SerdeTypeMap);
    case 'Nested':
      return nested(this as SerdeTypeNested);
    case 'Union':
      return union(this as SerdeTypeUnion);
    case 'UnionType':
      return unionType(this as SerdeTypeUnionType);
    case 'enum':
      return enumV(this as SerdeTypeEnum);
    case 'dynamic':
      return dynamic();
    case 'Late':
      return late(this as SerdeTypeLate);
    case 'Option':
      return option(this as SerdeTypeOption);
    default:
      throw Exception('SerdeType._inner $_inner not found in when');
  }
}