macAddress static method

FormFieldValidator<String> macAddress({
  1. RegExp? regex,
  2. String? errorText,
  3. bool checkNullOrEmpty = true,
})

FormFieldValidator that requires the field's value to be a valid MAC address.

Parameters:

  • errorText The error message when the MAC address is invalid.
  • checkNullOrEmpty Whether to check for null or empty values.

This regex matches MAC addresses.

  • It consists of six groups of two hexadecimal digits.
  • Each group is separated by a colon or hyphen.

Examples: 00:1A:2B:3C:4D:5E, 00-1A-2B-3C-4D-5E

Implementation

static FormFieldValidator<String> macAddress({
  RegExp? regex,
  String? errorText,
  bool checkNullOrEmpty = true,
}) => MacAddressValidator(
  regex: regex,
  errorText: errorText,
  checkNullOrEmpty: checkNullOrEmpty,
).validate;