skills/dart/dart-memory/SKILL.md
Manage memory efficiently in Dart and Flutter apps to prevent leaks and reduce GC pressure. Use when disposing resources, handling large assets, optimizing image caching, or profiling allocation patterns.
npx skillsauth add dhruvanbhalara/skills dart-memoryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Mobile devices have limited RAM. Efficient memory management is critical to prevent crashes and ensure a smooth user experience.
StreamController, Timer, FocusNode, and ChangeNotifier in the dispose() method.late to delay object creation until it's actually needed, reducing initial memory footprint.build() or high-frequency loops. Reuse data structures where possible.list.clear()) is better than re-assigning it to a new list if the list itself is long-lived.Isolate.run() for heavy computations (JSON parsing > 1MB, image processing). This keeps the main thread free and prevents UI freezes.cacheWidth and cacheHeight in Image.network or Image.asset to avoid loading high-resolution images into memory at full size.Stream to process data in chunks rather than buffering the entire content in memory.development
Perform REST API networking operations (GET, POST, PUT, DELETE) using the lightweight and robust standard `http` package, including platform configurations and background parsing models.
development
Configure internationalization and localization support using Flutter's built-in l10n system, App Resource Bundle (ARB) files, and ICU formatting syntax.
development
Create model classes with fromJson/toJson using dart:convert and Dart 3 pattern matching. Use when manually mapping JSON to classes, parsing HTTP responses, or choosing between manual and code-generated serialization.
data-ai
Diagnose and fix Flutter layout constraint violations (RenderFlex overflow, unbounded height/width, ParentData misuse). Use when encountering layout exceptions, yellow-black overflow stripes, or red error screens.