check method
Throws a FluvieRenderException when url is not permitted; returns
normally otherwise.
Implementation
void check(Uri url) {
if (!schemes.contains(url.scheme)) {
throw FluvieRenderException(
'Disallowed URL scheme "${url.scheme}" for "$url". The network '
'allowlist permits only: ${schemes.join(', ')}.',
);
}
if (url.host.isEmpty) {
throw FluvieRenderException('Network URL "$url" has no host to check against the allowlist.');
}
if (!_allowAnyHost && !hosts.contains(url.host)) {
throw FluvieRenderException(
'Disallowed host "${url.host}" for "$url". The network allowlist '
'permits only: ${hosts.join(', ')}.',
);
}
}