I've been trying to use Dart's noSuchMethod()
, but this code
noSuchMethod(InvocationMirror invocation) {
// ...
}
results in the following error: cannot resolve class name 'InvocationMirror' from 'MyClass'
It looks like there's no such class as InvocationMirror. Could it be an older version of dart which doesn't have it? The one I have is the stable one from SDK for Mac downloaded just today.
You're observing an inconsistency between specification and implementation (which shouldn't come as a surprise, there are a lot of them). You can use noSuchMethod
, at least on Dart VM (don't know about dart2js), but it looks like this: noSuchMethod(String name, List arguments)
. In the future, when reflection finally comes to Dart, it will change.