FhirDecimal constructor

FhirDecimal(
  1. dynamic inValue
)

Implementation

factory FhirDecimal(dynamic inValue) {
  if (inValue is FhirDecimal) {
    return inValue;
  } else if (inValue is FhirInteger) {
    return FhirDecimal._(
      inValue.toString(),
      inValue.value?.toDouble(),
      inValue.isValid,
      inValue.isValid,
    );
  } else if (inValue is num) {
    return FhirDecimal._(
      inValue.toString(),
      inValue.toDouble(),
      true,
      int.tryParse(inValue.toString()) != null,
    );
  }
  throw CannotBeConstructed<FhirDecimal>(
      'Decimal cannot be constructed from $inValue ${inValue.runtimeType}');
}