undeclared-dependencies
- Group
- Correctness
- Path
cross-file/correctness/undeclared-dependencies- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 447 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 package imports and exports missing from the enclosing pubspec.
Regular dependencies and self-imports are allowed everywhere; dev-dependencies
are allowed only outside lib/. Generated flutter_gen imports are exempt.
Malformed manifests are skipped; conditional alternatives are checked too.
depend-on-referenced-packages defers overlapping reports when this rule is
enabled, but retains its stricter bin/build-hook checks.
Invalid
import 'package:missing_0/api.dart';
import 'package:missing_1/api.dart';
import 'package:missing_2/api.dart';
import 'package:missing_3/api.dart';
export 'package:test_helpers/api.dart';
import 'local.dart' if (dart.library.io) 'package:conditional/api.dart';
export 'local.dart' if (dart.library.html) 'package:conditional_export/api.dart';import 'package:missing_0/api.dart';import 'package:missing_0/api.dart';import 'package:missing_1/api.dart';import 'package:missing_1/api.dart';import 'package:missing_2/api.dart';import 'package:missing_2/api.dart';import 'package:missing_3/api.dart';import 'package:missing_3/api.dart';export 'package:test_helpers/api.dart';export 'package:test_helpers/api.dart';import 'local.dart' if (dart.library.io) 'package:conditional/api.dart';import 'local.dart' if (dart.library.io) 'package:conditional/api.dart';export 'local.dart' if (dart.library.html) 'package:conditional_export/api.dart';Configure undeclared-dependencies
Set its severity in falcon.json under the cross-file section. See the configuration guide.
{
"cross-file": {
"rules": {
"correctness": {
"undeclared-dependencies": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore cross-file/correctness/undeclared-dependencies: <reason>More correctness rules
- unnecessary-flutter-importsrecommendedflutter
Disallow unused Flutter framework and
dart:asyncimports. - unnecessary-nullable
check-unnecessary-nullablecross-fileFlags private function or method parameters whose nullable type is unnecessary.
- unnecessary-nullable-return-type
unnecessary_nullable_return_typeDisallow nullable return types on functions that never return null.
- unnecessary-statements
unnecessary_statementsrecommendedFlags expression statements whose expression has no clear effect.
- unrelated-type-equality-checks
unrelated_type_equality_checksrecommendedReports
==/!=comparisons and relational==/!=patterns whose operand types are unrelated. - unused-code
check-unused-codecross-fileReport public top-level declarations that nothing references.
- unused-dependenciescross-file
Report regular pubspec dependencies with no Dart import or export in the analyzed package.
- unused-files
check-unused-filescross-fileReport
lib/files that no project entrypoint can reach.