extensions library

Functions

colorFromHex(String hex) Color
Parses #RGB, #RRGGBB, #AARRGGBB (with or without #) into a Color. Throws a FormatException for invalid input.
emailValidator(String? value, {String message = 'Enter a valid email'}) String?
Field must be a valid email (blank passes).
maxLengthValidator(String? value, int maxLength, {String? message}) String?
Field must be at most maxLength characters (blank passes).
minLengthValidator(String? value, int minLength, {String? message}) String?
Field must be at least minLength characters (blank passes).
phoneValidator(String? value, {String message = 'Enter a valid phone number'}) String?
Field must be a valid phone number (blank passes).
requiredField(String? value, {String message = 'This field is required'}) String?
Field must not be null/blank.

Typedefs

FormValidator = String? Function(String?)
Validator helpers returning an error String or null when valid. Use directly as validator: for TextFormField/FormField.