What is the purpose of placing @override in my PolymerDart methods when it works without?

In terms of creating classes that include inheritance, some really need redefinition annotations. When working with PolymerDart, however,

@override attached(){...} 

I see no reason why I need this. He works without him.

Since this is just an annotation, is it easy for developers to understand that a function overrides some other function?

My bet is that it’s easy for developers, and unlike other annotations that do some kind of execution, it’s not.

+5
source share
1 answer

If you included the linter rule annotate_overrides DartAnalyzer provides hints

  • for members that override other members of superclasses or interfaces but do not have @override annotations
  • for members that have an @override annotation but don't actually override other members of superclasses or interfaces.

The @override is useful if it is used sequentially because it shows when an element is an override.
The linter rule ensures that it will be used sequentially.

There is also an overridden_fields lint, but AFAIK it will be deprecated because. This was forbidden until recently in the Dart Development compiler, but this restriction has been removed. I do not know if this is still not recommended, but there are times when it makes sense, and therefore I think that the linter rule should no longer be used, because it is subject to hints for actual code.

+4
source

Source: https://habr.com/ru/post/1265742/


All Articles