ipv6Tov4 property

String? get ipv6Tov4

Convert an IPv6 address to an IPv4 address,

Implementation

String? get ipv6Tov4 {
  if (!this.isIPAddress) {
    return null;
  }
  if (this.isIPv4) {
    return this;
  }
  final regex = RegExp(r'^::ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$',
      caseSensitive: false);
  final match = regex.firstMatch(this!);
  if (match != null) {
    return match.group(1);
  }
  return null;
}