String built with + instead of interpolation
ID |
dart.maintainability.prefer_interpolation |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Idiom |
Language |
Dart |
Description
Build this string with interpolation ('Hello, $name') instead of +. Interpolation reads better and avoids the intermediate strings each concatenation allocates.
Rationale
Build this string with interpolation ('Hello, $name') instead of +. Interpolation reads better and avoids the intermediate strings each concatenation allocates.
The following code illustrates the pattern detected by this rule:
class Concats {
String greet(String name) {
// FLAGGED: String built with + instead of interpolation
return 'Hello, ' + name;
}
}