isLowerCase method Null safety

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

Returns a Validator that accepts a value where all letters are lower-case.

TODO: Check whether there is a better way to validate this.

Implementation

Validator isLowerCase({
  String message = "Validator.isLowerCase",
}) {
  return add(
    (value) => value == value?.toLowerCase() ? null : message,
  );
}