validate static method

String? validate(
  1. String? value, {
  2. bool required = false,
})

Implementation

static String? validate(String? value, {bool required = false}) {
  if (value == null || value.isEmpty) {
    return required ? ConectarDesignSystem.labels.requiredField : null;
  }

  if (!value.emailIsValid) {
    return ConectarDesignSystem.labels.emailInvalid;
  }

  return null;
}