Skip to content

Commit

Permalink
Make the item argument to Match dynamic again (#163)
Browse files Browse the repository at this point in the history
This argument had been implicitly dynamic. #162 made it `Object?` which
can cause analysis errors that are otherwise hidden due to implicit
casts. Any classes which implement `Matcher` and override `match` could
omit the argument type, which mean to inherit from the parent. When that
became `Object?` the cast to some other type which could have been
implicit coming from `dynamic` must now be explicit.
  • Loading branch information
natebosch authored Dec 29, 2020
1 parent 2071cfd commit 71eeaee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/interfaces.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class Matcher {
/// [item] is the actual value. [matchState] can be supplied
/// and may be used to add details about the mismatch that are too
/// costly to determine in [describeMismatch].
bool matches(Object? item, Map matchState);
bool matches(dynamic item, Map matchState);

/// Builds a textual description of the matcher.
Description describe(Description description);
Expand All @@ -54,7 +54,7 @@ abstract class Matcher {
/// A few matchers make use of the [verbose] flag to provide detailed
/// information that is not typically included but can be of help in
/// diagnosing failures, such as stack traces.
Description describeMismatch(Object? item, Description mismatchDescription,
Description describeMismatch(dynamic item, Description mismatchDescription,
Map matchState, bool verbose) =>
mismatchDescription;
}

0 comments on commit 71eeaee

Please sign in to comment.