Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Retain a check against Function
Browse files Browse the repository at this point in the history
The refactoring started rejecting generic functions, a `Function<T>()`
is not a subtype of a `Function()`.
  • Loading branch information
natebosch committed Nov 22, 2023
1 parent dd59642 commit b362392
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/src/expect/throws_matcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Throws extends AsyncMatcher {
// function.
@override
dynamic /*FutureOr<String>*/ matchAsync(Object? item) {
if (item is! Function() && item is! Future) {
if (item is! Function && item is! Future) {
return 'was not a Function or Future';
}

Expand All @@ -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 ');
Expand Down

0 comments on commit b362392

Please sign in to comment.