unused-dependencies

Path
cross-file/correctness/unused-dependencies
Default
Off, opt in
Origin
Falcon
Rule
480 of 512
cross-file

Cross-file rule. It runs in falcon's whole-project pass, analyzing relationships across every file rather than one file at a time. Configure it under the top-level cross-file key.

Report regular pubspec dependencies with no Dart import or export in the analyzed package.

All analyzed Dart locations count, including bin, test, tool and examples, as do conditional import/export alternatives. Dev-dependencies, SDK dependencies and plugins registered in .flutter-plugins-dependencies are exempt: native registration can use a plugin without a Dart import. Declared dependencies whose resolved pubspec declares Flutter fonts, assets or plugin metadata are also exempt, since Flutter can consume them without a Dart import. Resolution uses the nearest .dart_tool/package_config.json; missing or unreadable dependency metadata cannot establish this exemption. Nested packages are independent. This is a source-set check, not a pub solver: excluded/unscanned files, build-time tools and native-only packages without Flutter metadata cannot establish usage. Suppress intentional non-Dart dependencies in pubspec.

Invalid

bad/lib/app.dartdart
void main() {}

No diagnostics in this file.

Configure unused-dependencies

Set its severity in falcon.json under the cross-file section. See the configuration guide.

falcon.jsonjson
{
  "cross-file": {
    "rules": {
      "correctness": {
        "unused-dependencies": "error"
      }
    }
  }
}

Or silence one occurrence with a suppression comment; the reason is required.

example.dartdart
// falcon-ignore cross-file/correctness/unused-dependencies: <reason>