refactor(flutter_tools): clean up dead unreferenced declarations (#191163)
Removes dead, unreferenced internal declarations across
`packages/flutter_tools`.
This is a **deterministic, tool-guided cleanup** performed using
[`undead`](https://pub.dev/packages/undead) (whole-program AST
reachability analysis). Because candidate declarations are identified
through formal analyzer graph traversals rather than generative AI
synthesis, there is **almost zero risk of AI hallucinations or
speculative refactoring regressions**.
---
### 🔍 How `undead` Works & Non-Breaking Safety Guarantees
Unlike basic lexical lints (`unused_element`, `unused_field`) which only
detect file-private (`_`) identifiers within a single compilation unit,
`undead` builds a comprehensive reachability graph starting from:
1. **Public API Entrypoints**: All exported root declarations in
`lib/*.dart`.
2. **Executable Roots**: Binary/CLI command entrypoints.
3. **Test Suites**: Unit and integration test harnesses in `test/`.
Any internal declaration under `lib/src/` with zero reachable paths from
any entrypoint or test root is flagged as dead code.
#### Verification & Non-Breaking Invariants
* **Public API Preservation**: All public exports in `lib/` remain
strictly untouched.
* **Sealed Hierarchy Protection**: Subtypes of `sealed` classes are
preserved to guarantee Dart 3 pattern-matching switch exhaustiveness.
* **Framework Pragmas**: Entrypoints annotated with
`@pragma('vm:entry-point')` are preserved.
* **Regression Verification**: Verified clean via full `flutter_tools`
static analysis (`dart analyze`) and passing local test suites (`dart
test`) with zero behavioral drift.
---
### 📦 Removed Declarations
Removes dead unreferenced declarations identified during the codebase
reachability audit:
- AndroidSdkNdkHelpers, kSupportedAbis, writeLocalProperties,
conflictDetected
- OverrideArtifacts, kSystemCodeSuccess, kSystemCodeDeviceFull
- getNameForHostPlatform, getAotBuildDirectory, getFuchsiaBuildDirectory
- kXcodeBuildScriptValueBuild, kXcodeBuildScriptValueEmbed,
kXcodeBuildScriptValueAddToAppBuild
- getNameForTargetPlatform, getTargetPlatformForName
- verifyOutputDirectories, NoOpBuildTargets, _NoOpTarget
- getDefaultApplicationKernelPath, DiscoveredApp, NoIdeValidator,
ValidatorWithResult
- flutterMacOSFrameworkDir, OSArchitectures, _osTargets, kLuciEnvName
- loadDwdsDirectory, generateMethodArguments,
L10nMissingPlaceholderException
- HeaderGenerator, ConstructorGenerator, kExplicitlyExcludedPackages
- generateDDCBootstrapScript, parseVersionForWindows, EdgeValidator
- PreviewProperty, ParsedUnitResultExtension, SourceExtension, daemon id
Also removed unused imports left behind by deletions.
---
### 🤖 Tool Provenance & Reproduction
Dead code detection and reachability analysis performed with
[`undead`](https://pub.dev/packages/undead) (`v0.1.0`).
To reproduce or re-run this reachability audit locally:
```bash
cd packages/flutter_tools && dart run undead@
``` K
Kevin Moore committed
e003841b2d6c6e740f51e5a6ba6402acb1a5ff78
Parent: 0d23a03
Committed by GitHub <noreply@github.com>
on 8/26/2026, 1:45:10 AM