password static method

String? password(
  1. String? value, {
  2. String message = "Password must contain upper, lower, number & symbol",
})

Implementation

static String? password(String? value,
    {String message = "Password must contain upper, lower, number & symbol"}) {
  if (value == null || value.isEmpty) return null;

  final regex = RegExp(
      r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&]).{6,}$');

  if (!regex.hasMatch(value)) {
    return message;
  }
  return null;
}