-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
could you support @noExtends and @noImplements for abstract class #46331
Comments
This sounds like a request for "interface-less classes". We have other such requests in the language repository, and it might be part of any attempt to make sealed classes (it being a kind of "partially sealed"). It's definitely possible to add this to the analyzer as an annotation only. (I'd probably make it |
yes, it's my bad, @extends and @implements should be rename to @noImplements and @noExtends like you said. |
This would also be beneficial to federated plugins. Each platform implements a shared platform interface and we are programmatically checking that any class is extended and not implemented. But, there are still situations where a platform implementation can accidentally get around this. An analyzer warning would be easier to work with. cc @stuartmorgan @pq |
See also @lrhn's proposal: dart-lang/language#704 |
Also an added benefit with being able to force a client extending your class rather than implementing it is that you are also able to maintain some internal assertions. For instance, defining a |
These have all been implemented in the language. |
such as
class Base
is an abstract class, I just want people toextends
notimplements
, so I can use@noImplements(annotation in meta.dart)
:if people use with
class Child implements Base {...}
will get a warning by analyzerThe text was updated successfully, but these errors were encountered: