flutter-bug-investigation

Use when investigating bugs, crashes, or unexpected behavior in a Flutter app. Especially when issues involve Bloc state not emitting, null safety errors, BuildContext after async, GetIt DI failures, method channel mismatches, widget rebuilds, or memory leaks.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "flutter-bug-investigation" with this command: npx skills add desquared/agents-rules-skills/desquared-agents-rules-skills-flutter-bug-investigation

Bug Solving Skill (Flutter)

Foundation: Extends shared-bug-investigation with Flutter patterns.

Flutter Context

flutter --version && grep "sdk:" pubspec.yaml
grep -r "BlocProvider\|ChangeNotifier\|GetX" lib/  # State management

RCA: Check All Layers (data/domain/view)

# View Layer: Bloc/Cubit, widgets, state
find lib/feature/<feature>/view -name "*.dart"

# Domain Layer: Models, repository interfaces, business logic
find lib/feature/<feature>/domain -name "*.dart"

# Data Layer: DTOs, datasources, API calls
find lib/feature/<feature>/data -name "*.dart"

Debug by layer: View (Bloc emits?) → Domain (model mapping?) → Data (DTO parsing?)

Common Bug Patterns

Bloc State

// ❌ Missing emit → ✅ Add emit(LoadingState()), emit(LoadedState(data)), emit(ErrorState())

Null Safety

// ❌ user!.name → ✅ user?.name ?? 'Guest'

BuildContext After Async

// ❌ Navigator.pop(context) after await → ✅ if (!mounted) return; Navigator.pop(context);

GetIt DI

// ❌ Not registered → ✅ Add @injectable, run build_runner

Method Channels

// ❌ Wrong name → ✅ Match iOS/Android channel name

Widget Rebuilds

// ❌ BlocBuilder wraps Scaffold → ✅ Wrap only body

Memory Leaks

// ❌ Stream not closed → ✅ Override close(), call super.close()

Error Quick Reference

ErrorFix
type 'Null' is not a subtypeAdd ?? defaults
Looking up deactivated widgetCheck mounted
Object not registeredAdd @injectable, run build_runner
MissingPluginExceptionImplement native iOS/Android
setState() after dispose()Cancel timers/streams
RenderBox overflowFix constraints

Tools

flutter analyze              # Must pass (0 errors)
flutter test                 # All tests
flutter run --profile        # Performance

Validation

  • flutter analyze = 0 errors
  • flutter test passes
  • Manual test fixed
  • Tested iOS + Android (if platform-specific)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

shared-bug-investigation

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

ios-accessibility-validator

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

android-accessibility-validator

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

android-compose-architecture-review

No summary provided by upstream source.

Repository SourceNeeds Review