isAfter function
Validates that a DateTime is after date
.
This matcher has additional behavior when used in expectResponse, hasResponse, hasHeaders, hasBody: if the actual value is a String, it will attempted to be parsed into a DateTime first. If parsing fails, this matcher will fail.
expectResponse(response, 200, headers: {"x-timestamp": isAfter(DateTime())});
Implementation
Matcher isAfter(DateTime date) {
return predicate(
(DateTime d) => d.isAfter(date), "after ${date.toIso8601String()}");
}