parse method
- String source
Parses either Ip4Address or Ip6Address.
Implementation
static IpAddress parse(String source) {
for (var i = 0; i < source.length; i++) {
final c = source.substring(i, i + 1);
switch (c) {
case ":":
return Ip6Address.parse(source);
case ".":
return Ip4Address.parse(source);
}
}
return throw ArgumentError.value(source, "source");
}