isAfter function

bool isAfter(
  1. String? str, [
  2. String? date
])

check if the string is a date that's after the specified date

If date is not passed, it defaults to now.

Implementation

bool isAfter(String? str, [String? date]) {
  date ??= '${DateTime.now()}';

  DateTime strCompare;
  try {
    strCompare = DateTime.parse(date);
  } on FormatException {
    return false;
  }

  DateTime strDate;
  try {
    strDate = DateTime.parse(str!);
  } on FormatException {
    return false;
  }

  return strDate.isAfter(strCompare);
}