href property
The href pointing to the resource.
Can be a relative or absolute URI.
Implementation
@override
Uri get href {
final href = _resolvedHref;
final hrefUriVariables = _filterUriVariables(href);
if (hrefUriVariables.isEmpty) {
return href;
}
final Map<String, DataSchema> affordanceUriVariables = {
..._thingDescription.uriVariables ?? {},
..._interactionAffordance.uriVariables ?? {},
};
final userProvidedUriVariables = _userProvidedUriVariables;
if (userProvidedUriVariables != null) {
_validateUriVariables(
hrefUriVariables,
affordanceUriVariables,
userProvidedUriVariables,
);
}
// As "{" and "}" are "percent encoded" due to Uri.parse(), we need to
// revert the encoding first before we can insert the values.
final decodedHref = Uri.decodeFull(href.toString());
final expandedHref =
UriTemplate(decodedHref).expand(userProvidedUriVariables ?? {});
return Uri.parse(expandedHref);
}