unused-dependencies
- Group
- Correctness
- Path
cross-file/correctness/unused-dependencies- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 480 of 512
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
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.
{
"cross-file": {
"rules": {
"correctness": {
"unused-dependencies": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore cross-file/correctness/unused-dependencies: <reason>More correctness rules
- unused-files
check-unused-filescross-fileReport
lib/files that no project entrypoint can reach. - use-build-context-synchronously
use_build_context_synchronouslyrecommendedflutterFlags
BuildContextuse after an asynchronous gap without a mounted guard. - use-closest-build-contextrecommendedflutter
Use the nearest
BuildContextparameter inside nested callbacks. - use-key-in-widget-constructors
use_key_in_widget_constructorsrecommendedflutterRequire public widget constructors to accept or initialize a Flutter
Key. - use-once-constructors-once-provider
use_once_constructors_once_providerflutterRequire Riverpod once-providers to be created through
.once(). - use-ref-and-state-synchronouslyrecommendedriverpod
Flags notifier ref and state accesses after an async gap without ref.mounted.
- use-ref-read-synchronouslyrecommendedriverpod
Flags Riverpod WidgetRef.read calls after an async gap without a mounted guard.
- use-setstate-synchronouslyrecommendedflutter
Require a mounted check before calling setState after an async gap.