matcher icon indicating copy to clipboard operation
matcher copied to clipboard

isInstanceOf should be a method

Open Hixie opened this issue 6 years ago • 7 comments

@kevmoo @natebosch Based on our meeting today, Flutter is hiding TypeMatcher and isInstanceOf from test in all our tests (and in the flutter_test package that we export to our users), and instead just exporting a function called isInstanceOf. This is ugly and we would prefer if we could just have an isInstanceOf method so that we didn't need to have these hacks.

Hixie avatar Aug 14 '18 22:08 Hixie

When we're ready to roll a major release of matcher + test, we'll make this change!

kevmoo avatar Aug 14 '18 22:08 kevmoo

#110 didn't solve this. It used a different name that won't allow us to unfork.

Hixie avatar Mar 23 '19 00:03 Hixie

Will leave open until we can remove isInstanceOf with a breaking change version bump.

natebosch avatar Mar 23 '19 02:03 natebosch

Discussed offline - flutter_test will keep it's own isInstanceOf unless they decide to do a breaking change, or forever, which can be handled independently from anything test. We will not keep isInstanceOf in matcher or test once we have other compelling reasons for a breaking version bump.

natebosch avatar Mar 25 '19 18:03 natebosch

I'm not sure what the current intention is, but currently the documentation for isInstanceOf says:

DEPRECATED Use TypeMatcher instead.

but also:

Annotations @Deprecated('Use isA<MyType>() instead.')

which seems inconsistent.

jamesderlin avatar Sep 30 '19 22:09 jamesderlin

It's also confusing to recommend using TypeMatcher because Flutter has its own copy of the package:matcher docs, but in a Flutter context, package:matcher's TypeMatcher is hidden and TypeMatcher is something different.

jamesderlin avatar Sep 30 '19 23:09 jamesderlin

FYI: Flutter TypeMatcher is now marked as deprecated.

We shipped isA<T>, which can be pointed to by Flutters isInstanceOf function.

Can we close this out?

kevmoo avatar Feb 13 '20 20:02 kevmoo