urlFull method Null safety

String? urlFull(
  1. String url
)

Resolves full URL with HtmlWidget.baseUrl if available.

Implementation

String? urlFull(String url) {
  if (url.isEmpty) {
    return null;
  }
  if (url.startsWith('data:')) {
    return url;
  }

  final uri = Uri.tryParse(url);
  if (uri == null) {
    return null;
  }
  if (uri.hasScheme) {
    return url;
  }

  final baseUrl = _widget?.baseUrl;
  if (baseUrl == null) {
    return null;
  }

  return baseUrl.resolveUri(uri).toString();
}