leak_tracker
11.0.2, released a year ago by tools.dart.dev
Framework to detect memory leaks in Dart and Flutter applications
What it does
LeakTracker hooks into the Dart VM service to record object allocations and report leaks. It provides configuration for ignored objects, custom error messages, and integration with test helpers.
AI-written summary of version 11.0.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- Debugging memory issues during development
- Running CI tests that need to catch leaks
- Profiling performance of long‑running apps
Skip it when
- Production releases where runtime overhead matters
- Environments without access to vm_service (e.g., web)
Strengths
- Comprehensive leak detection via VM service
- Configurable ignored objects and error messages
- Supports test helpers and custom baselining
Weaknesses
- Requires vm_service, not usable on web
- Adds dependency on Dart VM service which may increase bundle size
- Setup requires manual initialization
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 5
Add leak_tracker to pubspec, import package, call LeakTracking.initialize() in main or test setup. No build_runner needed.
import 'package:leak_tracker/leak_tracker.dart';
void main() {
LeakTracking.initialize();
// Your app code
}Alternatives
Packages that do the same job and could replace leak_tracker.
- flutter_perf_monitor
Real-time performance monitoring with FPS tracking, memory usage, and CPU monitoring for Flutter.
60Compare
Works with
Packages commonly used together with leak_tracker: ones it builds on, ones built on it, and its own family.
- vm_serviceleak_tracker depends on itA library to communicate with a service implementing the Dart VM service protocol.
- clockleak_tracker depends on itA fakeable wrapper for dart:core clock APIs.
- coverageSame familyCollects, manipulates, and formats code coverage data in Dart
- ddsSame familyLibrary to spawn and communicate with the Dart Developer Service (DDS) via HTTP, WebSocket, or SSE.
- dds_service_extensionsSame familyExtension methods for package:vm_service to make requests to a Dart Development Service instance.
- dwdsSame familyProxies between the Chrome debug protocol and the Dart VM service protocol.
- dart_mcp_serverSame familyAn MCP server for Dart projects, exposing developer tools to AI models.
- webdevSame familyA command-line tool for developing and deploying web applications with Dart.