In terms of creating classes which involve inheritance, some actually need the annotation of override. When working with PolymerDart though, specifically
@override
attached(){...}
I see no reason why i need it. It works as expected without it.
Since it is just an annotation, is it just for Developers to see so they understand that function is overriding some other function?
My bet is that it is just for developers, and unlike other annotations which carry out some sort of execution, these do not.
If you enable the linter rule annotate_overrides the DartAnalyzer provides hints
@override
annotation@override
annotation, but don't actually override other members of superclasses or interfaces.The @override
annotation is helpful if it is used consistently, because it shows when a member is an override.
The linter rule ensures that it is used consistently.
There is also the `overridden_fields lint, but AFAIK this is going to be deprecated because. This was forbidden until recently in Dart Development compiler but this restriction was removed. I don't know if it is still discouraged, but there are cases where it makes sense and therefore I think the linter rule shouldn't be used anymore because it is prone to cause hints for valid code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With