unused-files
Same as check-unused-files in Dart Code Metrics
- Group
- Correctness
- Path
cross-file/correctness/unused-files- Default
- Off, opt in
- Origin
- Dart Code Metrics
- Rule
- 481 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 lib/ files that no project entrypoint can reach.
Models the file set as a directed graph (file → every file its
imports/exports/parts reference) and flags a lib/src/** file when no
entrypoint reaches it. Entrypoints ("roots") are: any analyzed file outside
lib/ (bin/test/tool/example, or their own concern), any file declaring a
top-level main, and the public library surface — every lib/ file not
under lib/src/, which external packages may import (this subsumes the
lib/<pkg>.dart barrel). Reachability, not mere reference count, is the test:
a cluster of lib/src files that reference only each other but that nothing
live reaches is dead and is flagged. part of files belong to their owning
library and are never flagged directly. Without a pubspec the scope narrows
to files with a lib/ path component and the public-surface exemption is not
applied (no lib/ root is known). This is a cross-file rule: it runs in the
cross-file pass and is configured under the top-level cross-file section.
Invalid
void orphan() {}void orphan() {}Configure unused-files
Set its severity in falcon.json under the cross-file section. See the configuration guide.
{
"cross-file": {
"rules": {
"correctness": {
"unused-files": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore cross-file/correctness/unused-files: <reason>More correctness rules
- 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.
- valid-regexps
valid_regexpsrecommendedDisallow statically known invalid
dart:coreregular expressions.