openConnection method
Opens a new UrlConnection to the resource represented by this Url.
The actual implementation depends on the scheme:
"http"
and"https"
→ HttpUrlConnection
Throws a NetworkException if the protocol is unsupported.
Implementation
UrlConnection openConnection() {
switch (protocol) {
case 'http':
case 'https':
return HttpUrlConnection(this);
default:
throw NetworkException('Unsupported protocol: $protocol');
}
}