dockerHostHostname function
Returns the hostname portion of an SSH-based Docker host URL.
For example, ssh://user@myhost.example.com returns
'myhost.example.com'.
Returns null when dockerHost is not an SSH URL or the host
component is empty.
Implementation
String? dockerHostHostname() {
final rawHost = dockerHost();
if (rawHost == null || !rawHost.startsWith('ssh://')) {
return null;
}
final uri = Uri.parse(rawHost);
return uri.host.isNotEmpty ? uri.host : null;
}