iDNumberTypeFromJson function

IDNumberType iDNumberTypeFromJson(
  1. Object? iDNumberType, [
  2. IDNumberType? defaultValue
])

Implementation

enums.IDNumberType iDNumberTypeFromJson(
  Object? iDNumberType, [
  enums.IDNumberType? defaultValue,
]) {
  if (iDNumberType is String) {
    return enums.$IDNumberTypeMap.entries
        .firstWhere(
            (element) =>
                element.value.toLowerCase() == iDNumberType.toLowerCase(),
            orElse: () =>
                const MapEntry(enums.IDNumberType.swaggerGeneratedUnknown, ''))
        .key;
  }

  final parsedResult = defaultValue == null
      ? null
      : enums.$IDNumberTypeMap.entries
          .firstWhereOrNull((element) => element.value == defaultValue)
          ?.key;

  return parsedResult ??
      defaultValue ??
      enums.IDNumberType.swaggerGeneratedUnknown;
}