required method

FormFieldValidator required ({String errorText: "This field cannot be empty." })

FormFieldValidator that requires the field have a non-empty value.

Implementation

static FormFieldValidator required({
  String errorText = "This field cannot be empty.",
}) {
  return (val) {
    if (val == null || val.isEmpty) {
      return errorText;
    }
  };
}