IPv4 constructor

IPv4({
  1. String? mal,
})

Validates IPv4 addresses using a regular expression that is suitable for manually entered IP's. Examples:

If the ipv4 field is mandatory, see ReqIPv4 or Req.

mal the error message in case of a malformed IP address; if omitted, the default message will be 'malformed IP address'.

Implementation

IPv4({String? mal})
    : _ipv4Val = ((String? ipv4) {
        return (ipv4 == null || _matcher.hasMatch(ipv4))
            ? null
            : mal ?? 'malformed IP address';
      });