isLocalhost property

bool get isLocalhost

Check if this is a localhost address

Implementation

bool get isLocalhost {
  if (isIPv4) {
    return ip[12] == 127; // 127.x.x.x
  } else {
    // IPv6 ::1
    return ip.take(15).every((b) => b == 0) && ip[15] == 1;
  }
}