undead
0.1.2, released 6 weeks ago by kevmoo.com
Reachability and dead/unused declaration analysis for Dart and Flutter packages.
What it does
Performs whole-package AST analysis using package:analyzer to build a reachability graph from known entrypoints to internal declarations. Identifies unused top-level declarations, classes, functions, and variables, supporting both open-world library modes and closed-app executable analysis.
AI-written summary of version 0.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to audit your Dart or Flutter package for dead or unused code
- You need automated CI checks to fail if dead code is introduced
- You want to find internal declarations that can be safely made private
Skip it when
- You are looking for runtime performance profiling rather than static dead code analysis
Strengths
- Supports dual analysis modes (open-world library and closed-app)
- Framework adapters for Flutter, build_runner, and package test
- Co-invoked test hazard protection to avoid false-positive test deletions
- Granular suppressions via code directives
Weaknesses
- May require configuration for complex dynamic dependency injection or reflection-heavy code patterns
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
Can be run directly via CLI using dart run undead or embedded as a library in Dart scripts.
import 'package:undead/undead.dart';
void main() async {
final options = UndeadOptions(
packagePath: '.',
mode: AnalysisMode.library,
);
final engine = UndeadEngine(options);
final report = await engine.analyze();
for (final finding in report.undead) {
print('Unused: ${finding.name} (${finding.file}:L${finding.line})');
}
}Alternatives
Packages that do the same job and could replace undead.
- ciach
Dead code detector for Dart and Flutter that finds and removes unused declarations.
80Compare - cognitive_complexity
Algorithmic Cognitive Complexity calculation and Data-Flow analysis library and CLI tools.
74Compare - saropa_lints
Static analysis suite with 2300+ custom lint rules for Flutter and Dart
76Compare - skills_lint
Static analysis linter and CLI tool for Agent Skills (SKILL.md) structure and metadata
83Compare
Works with
Packages commonly used together with undead: ones it builds on, ones built on it, and its own family.
- analyzerundead depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamlundead depends on itA Dart library for parsing YAML documents into Dart data structures.
- ioundead depends on itUtilities for the Dart VM Runtime including ANSI colors, file copying, and exit code values.
- argsundead depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.