27 lines
506 B
Plaintext
27 lines
506 B
Plaintext
![]() |
== Why is this an issue?
|
||
|
|
||
|
In Dart there's an ability to use template literals instead of concatenation. Since their use is clearer and more concise, they are preferred.
|
||
|
|
||
|
|
||
|
=== Noncompliant code example
|
||
|
|
||
|
[source,dart]
|
||
|
----
|
||
|
void sayHello(name) {
|
||
|
print('hello ' + name + '!'); // Noncompliant
|
||
|
}
|
||
|
----
|
||
|
|
||
|
=== Compliant solution
|
||
|
|
||
|
[source,dart]
|
||
|
----
|
||
|
void sayHello(name) {
|
||
|
print('hello $name!');
|
||
|
}
|
||
|
----
|
||
|
|
||
|
== Resources
|
||
|
|
||
|
* https://dart.dev/tools/linter-rules/prefer_interpolation_to_compose_strings[Dart Lint rule]
|