skills/flutter/flutter-debugging/SKILL.md
Debug and profile Flutter applications using DevTools, structured logging, and memory analysis. Use when diagnosing layout issues, tracking performance bottlenecks, or setting up centralized error reporting with Crashlytics.
npx skillsauth add dhruvanbhalara/skills flutter-debuggingInstall 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.
AppLogger class for all logging — NEVER use print() or raw debugPrint()verbose, debug, info, warning, error, fatalAppLogger.error('Failed to fetch user', error: e, stackTrace: st)showPerformanceOverlay: true) to monitor frame ratesdebugPaintSizeEnabled = true to visualize widget boundariesRenderFlex overflowed — use Expanded, Flexible, or constrain dimensionsListView in SizedBox or use shrinkWrap: true with NeverScrollableScrollPhysicsdebugPrint('$runtimeType rebuild') temporarily to identify excessive rebuilds — remove before committry-catch blocks with stack tracesassert() for development-time invariant checks that are stripped in release buildsTimer, and AnimationController in dispose()late initialization in initState() — never inline-initialize disposable objectsWeakReference for caches that should not prevent garbage collectionBuildContext, global streams without cancellation--profile mode (not debug): flutter run --profile --flavor dev -t lib/main_dev.dartTimeline.startSync / Timeline.finishSync for custom performance tracing of critical paths--cache-sksl for warmup:
flutter run --profile --cache-sksl --purge-persistent-cache
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError)FlutterError.onError and PlatformDispatcher.instance.onError to catch framework and async errorsCategorize and fix Dart runtime errors systematically using static analysis and type system knowledge.
covariant keyword when intentionally tightening parameter types.List<int> not List<dynamic>). Never assign List<dynamic> to a typed list.dynamic. Use explicit casts (as Type) only when runtime type is guaranteed.analysis_options.yaml:
analyzer:
language:
strict-casts: true
| Error | Cause | Fix |
|---|---|---|
| Property cannot be accessed on nullable receiver | Accessing member on Type? | Use ?. or null check |
| Non-nullable instance field must be initialized | Uninitialized non-null field | Use late or make nullable |
| The argument type can't be assigned | Type? passed where Type expected | Add null check or ! (with caution) |
Rules:
! operator — prefer pattern matching or early returns.late only when initialization is guaranteed before first access._ wildcard (Dart 3.7+) for unused variables.# 1. Identify all errors
dart analyze . --fatal-infos
# 2. Preview automated fixes
dart fix --dry-run
# 3. Apply automated fixes
dart fix --apply
# 4. Verify resolution
dart analyze .
dart test
Feedback Loop: If dart test fails with TypeError after fixing → you introduced an invalid cast (as T) or accessed an uninitialized late variable. Locate and correct.
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.