ipv6Validator static method
ipv6Validator to validate ipv6
validator: (value) => SimpleValidations.ipv6Validator(value, [errorMessage]),
Implementation
static String? ipv6Validator(String? value, [String? errorMessage]) {
RegExp regex = CustomRegEx.ipv6Regex;
if (value == null || value.isEmpty) {
return errorMessage ?? 'Required';
} else if (!regex.hasMatch(value)) {
return errorMessage ?? 'Please enter a valid IPv6 address';
}
return null;
}