getAddressFamily function
Convert DNS lookup options family to a numeric address family value.
Implementation
int getAddressFamily(dynamic family) {
if (family == null || family == 'IPv4') return 4;
if (family == 0) return 0;
if (family == 4) return 4;
if (family == 6) return 6;
if (family == 'IPv6') return 6;
throw ArgumentError('Unsupported address family: $family');
}