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 ');