isNotEmpty method Null safety

Validator isNotEmpty(
  1. {String message = "Validator.isNotEmpty"}
)

Returns a Validator that accepts a value that is not null or empty.

accepts:

"foo"

rejects:

null, "", " ",

Implementation

Validator isNotEmpty({
  String message = "Validator.isNotEmpty",
}) {
  return add(
    (value) => value == null || value.trim().isEmpty ? message : null,
  );
}