Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add proxy class that can implement interfaces at runtime. #5641
In unchecked mode it's possible to create objects that implement an interface via noSuchMethod and assign them to a variable or argument of the interface type. This is useful for things like typed proxies for JS interop, automatic stubs for remote/isolated services, etc. In checked mode though assigning to a typed variable causes an exception.
For Proxy, this should work:
var proxy = new Proxy([Foo, Bar]);
Then subclasses can implement behavior.
This comment was originally written by cvl.c...@gmail.com
Is there any progress on this matter?
I use this pattern a lot in my code. For now I do a workaround and introduce a new class for every proxied class but that's cumbersome.
For me to invest more in the dart language, I need to be sure that this is gonna be implemented somehow at some point in the (near) future.
TL;DR: we see the need, but we are not currently working on it.