FhirUnsignedInt constructor

FhirUnsignedInt(
  1. dynamic inValue
)

Implementation

factory FhirUnsignedInt(dynamic inValue) {
  if (inValue is int) {
    return inValue >= 0
        ? FhirUnsignedInt._(inValue.toString(), inValue, true)
        : FhirUnsignedInt._(inValue.toString(), null, false);
  } else if (inValue is num) {
    final int? tempUnsignedInt = int.tryParse(inValue.toString());
    return tempUnsignedInt == null
        ? FhirUnsignedInt._(inValue.toString(), null, false)
        : tempUnsignedInt >= 0
            ? FhirUnsignedInt._(inValue.toString(), tempUnsignedInt, true)
            : FhirUnsignedInt._(inValue.toString(), null, false);
  }
  throw CannotBeConstructed<FhirUnsignedInt>(
      'UnsignedInt cannot be constructed from $inValue.');
}