future function

String future (
  1. DateTime fieldValue,
  2. {String message}
)

Validates that fieldValue (DateTime) is in the future.

Returns null if fieldValue > DateTime.now() else an error message

Implementation

String future(
  DateTime fieldValue, {
  String message,
}) {
  if ((fieldValue == null) || (fieldValue.isAfter(DateTime.now()))) {
    return null;
  }
  return message ?? 'Please enter a value in the future';
}