missing-use-result-annotation
Warns when a method or function declaration is missing the @useResult annotation.
@useResult annotation is used by the Dart analyzer to indicate that the value obtained by invoking a declaration should be used.
note
This rule requires configuration in order to highlight any issues.
⚙️ Config
Set type-pattern (default is none) to configure a regular expression for return types that should have the annotation.
Set methods (default is empty) to configure the list of declarations that should have the annotation.
analysis_options.yaml
dcm:
  rules:
    - missing-use-result-annotation:
        type-pattern: ^Either<
        methods:
          - toJson
Example
❌ Bad:
// LINT: Missing a 'useResult' annotation. Try adding it.
Either<Left, Right> either() => ...;
✅ Good:
Either<Left, Right> either() => ...;