Group: style
Maturity: stable
Dart SDK: >= 2.14.0 • (Linter v1.5.0)
Since info is static, may be staleSome operations on primitive types are idempotent and can be removed.
BAD:
doubleValue.toDouble();
intValue.toInt();
intValue.round();
intValue.ceil();
intValue.floor();
intValue.truncate();
string.toString();
string = 'hello\n'
'world\n'
''; // useless empty string
'string with ${x.toString()}';
To enable the noop_primitive_operations
lint,
add noop_primitive_operations
under linter > rules in your
analysis_options.yaml
file:
linter:
rules:
- noop_primitive_operations