Pattern: Inconsistent use of @Deprecated()
Issue: -
Do apply @Deprecated()
consistently:
- if a class is deprecated, its constructors should also be deprecated.
- if a field is deprecated, the constructor parameter pointing to it should also be deprecated.
- if a constructor parameter pointing to a field is deprecated, the field should also be deprecated.
Example of incorrect code:
@deprecated
class A {
A();
}
class B {
B({this.field});
@deprecated
Object field;
}
Example of correct code:
@deprecated
class A {
@deprecated
A();
}
class B {
B({@deprecated this.field});
@deprecated
Object field;
}