FhirCanonical constructor

FhirCanonical(
  1. dynamic inValue
)

Implementation

factory FhirCanonical(dynamic inValue) {
  if (inValue is Uri) {
    return FhirCanonical._(inValue.toString(), inValue, true);
  } else if (inValue is String) {
    if (RegExp(r'^\S*$').hasMatch(inValue)) {
      final Uri? tempUri = Uri.tryParse(inValue);
      return FhirCanonical._(inValue, tempUri, tempUri != null);
    }
    return FhirCanonical._(inValue, null, false);
  }

  throw CannotBeConstructed<FhirCanonical>(
      'Canonical cannot be constructed from $inValue.');
}