# isIP method

bool isIP([

1. Object? version

])

Check if the string is an IP (version 4 or 6)

`version` is a String or an `int`.

## Implementation

    bool isIP([Object? version]) {
      final String str = this;

      assert(version == null || version is String || version is int);
      version = version.toString();
      if (version == 'null') {
        return str.isIP(4) || isIP(6);
      } else if (version == '4') {
        if (!RegexUtils.ipv4.hasMatch(str)) {
          return false;
        }
        var parts = str.split('.');
        parts.sort((a, b) => int.parse(a) - int.parse(b));
        return int.parse(parts[3]) <= 255;
      }
      return version == '6' && RegexUtils.ipv6.hasMatch(str);
    }