avoid_single_cascade_in_expression_statements
Details about the 'avoid_single_cascade_in_expression_statements' diagnostic produced by the Dart analyzer.
Unnecessary cascade expression.
Description
#The analyzer produces this diagnostic when a single cascade operator is used and the value of the expression isn't being used for anything (such as being assigned to a variable or being passed as an argument).
Example
#
The following code produces this diagnostic because the value of the
cascade expression s..length isn't being used:
void f(String s) {
s..length;
}
Common fixes
#Replace the cascade operator with a simple access operator:
void f(String s) {
s.length;
}
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.