-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add proxy class that can implement interfaces at runtime. #5641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This comment was originally written by [email protected] 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. |
Issue #6244 has been merged into this issue. |
Added C1 label. |
This comment was originally written by [email protected] IMO related:
|
Hey team, just curious, the fact that it's not I am really interested in solution for this use case. |
@pulyaevskiy: TL;DR: we see the need, but we are not currently working on it. |
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]);
assert(proxy is Bar);
assert(proxy is Foo);
Then subclasses can implement behavior.
The text was updated successfully, but these errors were encountered: