shorthand_inside_shorthand
Reports a dot-shorthand call passed as an argument to another dot-shorthand call, as in .all(.circular(8)). Write out one of the two types.
- Tier
- advisory
- Scope
- Dart
- Lowest preset
- strict
- Fix
- none
What it reports
Section titled “What it reports”A static method or constructor call written as a dot shorthand that is an argument, positional or named, of another call written as one: .all(.circular(8)). The violation covers the inner call.
It does not report:
- a shorthand that only names a value:
.center,.zero; - one level of shorthand;
- a shorthand inside a function literal passed as an argument.
Each shorthand takes its type from the parameter it is passed to. With two in a row, no type is named on the line, and a reader has to look up two signatures.
Example
Section titled “Example”Corners round() => .all(.circular(8));Corners round() => .all(Radius.circular(8));Rule parameters
Section titled “Rule parameters”Set under the assay: key of the project’s root analysis_options.yaml.
| Rule parameter | Default | Effect |
|---|---|---|
enabled |
true |
false switches the rule off for the whole project. |
exclude |
[] |
Path globs where the rule is silent. |
Suppressing it
Section titled “Suppressing it”Write why on the line directly above the suppression:
// Why it stays as written here.// ignore: assay/shorthand_inside_shorthand// ignore_for_file: assay/shorthand_inside_shorthand silences it in a whole file, and // ignore: shorthand_inside_shorthand without the prefix works too. See Suppressions.