notBlank function

bool notBlank(
  1. dynamic property,
  2. ConstraintValidatorContext cvc
)

Implementation

bool notBlank(dynamic property, ConstraintValidatorContext cvc) {
  if (property == null) {
    return false;
  }
  if (property is! String) {
    throw StateError('NotBlank validation can only by tested on a String');
  }
  return property.replaceAll(' ', '').isNotEmpty;
}