2024-07-10 17:44:19 +02:00
|
|
|
include::../rationale.adoc[]
|
|
|
|
|
|
|
|
include::../how-to-fix-it.adoc[]
|
|
|
|
|
|
|
|
=== Code examples
|
|
|
|
|
|
|
|
==== Noncompliant code example
|
|
|
|
|
|
|
|
[source,dart,diff-id=1,diff-type=noncompliant]
|
|
|
|
----
|
|
|
|
int numberOfMinutes(int hours) {
|
|
|
|
int seconds = 0; // Noncompliant - seconds is unused
|
|
|
|
return hours * 60;
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
==== Compliant solution
|
|
|
|
|
|
|
|
[source,dart,diff-id=1,diff-type=compliant]
|
|
|
|
----
|
|
|
|
int numberOfMinutes(int hours) {
|
|
|
|
return hours * 60;
|
|
|
|
}
|
|
|
|
----
|
2024-07-11 15:00:51 +02:00
|
|
|
|
|
|
|
== Resources
|
|
|
|
|
|
|
|
* https://dart.dev/tools/linter-rules/curly_braces_in_flow_control_structures[Dart compiler diagnostic]
|