Search code examples
dartproxy-classestypechecking

dart, keeping type checking on but letting proxys through?


Im passing a proxy object in to a method which expects a specific argument type, the proxy object isn't an instance of the expected type however it does through it's noSuchMethod support all the functionality of the expected concrete type, I want to keep the argument type specification for static type checking whilst I'm coding, I would also like to keep the type checking on whilst I'm debugging my code, but I thought it wouldn't throw type exceptions when the class that causes the error is a proxy object? is there anyway to do this with all the type checking on?


Solution

  • You could implement the argument type.

    @proxy
    class MyProxy implements MyArgumentType {
      ...
    }