Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Dead Code in Flutter Is More Than an Analyzer Warning

说明与用途

flutter-dead-code-audit 通过将机械证据与人工判断分离,帮助安全删除 Flutter 中真正的死代码。

问题

Determining whether a Flutter file or declaration is truly dead is hard because analyzer warnings alone are insufficient; code may be referenced indirectly through routes, DI, exports, or platform-specific imports.

结果

The tool provides a structured, review-first workflow that separates mechanical evidence from human judgment, enabling safe removal of dead code while avoiding accidental deletions.

工作流

  • Run the audit mode to generate a list of candidate dead code based on analyzer diagnostics, reachability, symbol searches, and framework checks.
  • Review candidates in small groups, assigning each a decision: remove, retain, or defer.
  • Apply cleanup only to items marked remove, in small batches, followed by analyzer and test verification.
  • After cleanup, run behavior-oriented tests to ensure no functionality was unintentionally affected.

证据

Finding an unused_element warning is easy. Deciding whether a file is safe to delete is not.

来源

The skill uses four stages: Audit, Review, Cleanup, Tests.

来源

The result is a list of candidates, not an automatic deletion list.

来源

Cleanup is allowed only for candidates explicitly approved as remove.

来源

  • 记录日期: 2026-11-04T00:13:48.990Z