From b3623925310e4bf026ca160cf90359b676402953 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Wed, 22 Nov 2023 00:46:52 +0000 Subject: [PATCH] Retain a check against `Function` The refactoring started rejecting generic functions, a `Function()` is not a subtype of a `Function()`. --- lib/src/expect/throws_matcher.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/expect/throws_matcher.dart b/lib/src/expect/throws_matcher.dart index a2aba50..96a8b6d 100644 --- a/lib/src/expect/throws_matcher.dart +++ b/lib/src/expect/throws_matcher.dart @@ -73,7 +73,7 @@ class Throws extends AsyncMatcher { // function. @override dynamic /*FutureOr*/ matchAsync(Object? item) { - if (item is! Function() && item is! Future) { + if (item is! Function && item is! Future) { return 'was not a Function or Future'; } @@ -82,7 +82,8 @@ class Throws extends AsyncMatcher { } try { - item as Function(); + item as Function; + // ignore: avoid_dynamic_calls var value = item(); if (value is Future) { return _matchFuture(value, 'returned a Future that emitted ');