FhirInstant constructor

FhirInstant(
  1. dynamic inValue
)

Implementation

factory FhirInstant(dynamic inValue) {
  if (inValue is DateTime) {
    return FhirInstant._(inValue.toIso8601String(), inValue, true, null);
  } else if (inValue is String) {
    try {
      final DateTime dateTimeValue = _parseDateTime(inValue);
      return FhirInstant._(inValue, dateTimeValue, true, null);
    } on FormatException catch (e) {
      return FhirInstant._(inValue, null, false, e);
    }
  } else {
    throw CannotBeConstructed<dynamic>(
        'Instant cannot be constructed from $inValue.');
  }
}