isValidIPv6 static method

bool isValidIPv6(
  1. String ip
)

Validates if the given string is a valid IPv6 address.

Implementation

static bool isValidIPv6(String ip) {
  final regex = RegExp(r'^(?:[a-fA-F0-9]{1,4}:){7}[a-fA-F0-9]{1,4}\$');
  return regex.hasMatch(ip);
}