avoid_single_cascade_in_expression_statements
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:
dart
void f(String s) {
s..length;
}
Common fixes
#Replace the cascade operator with a simple access operator:
dart
void f(String s) {
s.length;
}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.