hostOf function

String hostOf(
  1. String url
)

The host of a URL for display — never the whole URL (§5.4 / ).

Implementation

String hostOf(String url) {
  final host = Uri.tryParse(url)?.host;
  return (host == null || host.isEmpty) ? url : host;
}