rspec/rules/S1123/dart/rule.adoc

29 lines
938 B
Plaintext
Raw Normal View History

2024-07-10 11:37:55 +02:00
== Why is this an issue?
Deprecation should be marked with both the ``++@Deprecated++`` annotation. This annotation triggers compiler to produce a warning, when the deprecated element is used. It also enables tools such as IDEs to warn about referencing deprecated elements. When using this annotation, it is important to add a message to the deprecation to explain when it was deprecated, why, and how references should be refactored.
=== Noncompliant code example
[source, dart]
----
@deprecated
void oldFunction(arg1, arg2) {}
----
=== Compliant solution
[source, dart]
----
@Deprecated("""
[oldFunction] is being deprecated in favor of [newFunction] (with slightly
different parameters; see [newFunction] for more information). [oldFunction]
will be removed on or after the 4.0.0 release.
""")
void oldFunction(arg1, arg2) {}
----
2024-07-11 15:00:51 +02:00
== Resources
* https://dart.dev/tools/linter-rules/provide_deprecation_message[Dart Lint rule]