before function

String before (
  1. DateTime fieldValue,
  2. DateTime checkValue,
  3. {String message}
)

Validates that fieldValue (DateTime) is before checkValue.

Returns null if fieldValue < checkValue else an error message

Implementation

String before(
  DateTime fieldValue,
  DateTime checkValue, {
  String message,
}) {
  if ((fieldValue == null) || (fieldValue.isBefore(checkValue))) {
    return null;
  }
  return message ?? 'Please enter a value in the past of $checkValue';
}