Whether ip is an IPv4 address.
ip
static bool isIPv6(String ip) { try { return InternetAddress(ip).type == InternetAddressType.IPv6; } catch (_) { return false; } }