futureDate static method

String? futureDate(
  1. String? value, {
  2. String? message,
})

Validates that date is in the future

Example:

Validators.futureDate('2025-01-15');

Implementation

static String? futureDate(String? value, {String? message}) {
  if (value == null || value.isEmpty) return null;
  try {
    final date = DateTime.parse(value);
    if (!date.isAfter(DateTime.now())) {
      return message ?? 'Date must be in the future';
    }
    return null;
  } catch (_) {
    return message ?? 'Please enter a valid date';
  }
}