IPv4Network constructor
Creates a new IPv4Network. Throw ValueError when strict opstion is true and network address is not supplied.
Implementation
IPv4Network(String addr, {bool strict = true}) {
var ap = _splitAddrPrefix(addr);
_ip = BigInt.from(_ipIntFromString(ap[0]));
_prefixlen = _makePrefix(ap[1]);
var packed = networkAddress.toInt();
if (packed & netmask.toInt() != packed) {
if (strict) {
throw ValueError('$addr has host bits set.');
} else {
_ip = BigInt.from(packed & netmask.toInt());
}
}
}