29 lines
541 B
Plaintext
29 lines
541 B
Plaintext
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;
|
|
}
|
|
----
|
|
|
|
== Resources
|
|
|
|
* https://dart.dev/tools/linter-rules/curly_braces_in_flow_control_structures[Dart compiler diagnostic]
|