IPv6Network constructor

IPv6Network(
  1. String addr, {
  2. bool strict = true,
})

Creates a new IPv6Network. Throw ValueError when strict opstion is true and network address is not supplied.

Implementation

IPv6Network(String addr, {bool strict = true}) {
  var ap = _splitAddrPrefix(addr);
  _ip = _ipIntFromString(ap[0]);
  _prefixlen = _makePrefix(ap[1]);
  var packed = networkAddress.toBigInt();
  if (packed & netmask.toBigInt() != packed) {
    if (strict) {
      throw ValueError('$addr has host bits set.');
    } else {
      _ip = packed & netmask.toBigInt();
    }
  }
}