isLinkLocal property

  1. @override
bool isLinkLocal
override

Whether the scope of the InternetAddress is a link-local.

Implementation

@override
bool get isLinkLocal {
  // Copied from dart:io
  switch (type) {
    case io.InternetAddressType.IPv4:
      // Checking for 169.254.0.0/16.
      return _inAddr[0] == 169 && _inAddr[1] == 254;
    case io.InternetAddressType.IPv6:
      // Checking for fe80::/10.
      return _inAddr[0] == 0xFE && (_inAddr[1] & 0xB0) == 0x80;
  }
  throw StateError('Unreachable');
}