flutter-feature-implementation

Use when implementing a Flutter feature from scratch or completing one in progress. Covers file structure, design system compliance, state management setup, error handling, testing, and build_runner requirements.

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-feature-implementation" with this command: npx skills add desquared/agents-rules-skills/desquared-agents-rules-skills-flutter-feature-implementation

Feature Implementation Skill

Checklist

Code Structure

  • Files in data/domain/view (DTOs → data, Models → domain)
  • @JsonSerializable on DTOs, Equatable on Models
  • Repository interface in domain, implementation in data
  • Bloc (complex) or Cubit (simple) in view

Design System

  • ColorPalette (no hardcoded colors)
  • Spacing (no magic numbers)
  • Project's Design System Text Widgets (typography)
  • Project's Design System Assets (images/icons)
  • Core widgets (lib/core/widgets/)

State Management

  • Bloc for complex (multiple events), Cubit for simple
  • @injectable on classes (auto-registration)
  • BlocProvider at page level
  • BlocBuilder scoped to minimal subtree

Error Handling

  • Try-catch in repositories
  • Map DioException → custom exceptions (NetworkException, NotFoundException)
  • Error states in Bloc/Cubit
  • User-friendly messages

Testing

  • Unit tests for Bloc/Cubit (90%+ target)
  • Mock with mocktail
  • Test structure mirrors source
  • Use fixtures for mock data

Quality

  • flutter analyze passes (zero errors)
  • Run ./build_runner.sh after changes
  • Commit *.g.dart files

Patterns

// ✅ Clear naming
class FeatureRepository {}

// ✅ Null safety
final name = user?.name ?? 'Guest';

// ✅ const
const Text('Static');

// ✅ Async/await
try {
  final data = await repository.fetch();
  emit(LoadedState(data));
} catch (e) {
  emit(ErrorState(e.toString()));
}

// ✅ Bloc test
blocTest<MyBloc, MyState>(
  'emits [Loading, Loaded]',
  build: () {
    when(() => repository.fetch()).thenAnswer((_) async => data);
    return bloc;
  },
  act: (bloc) => bloc.add(LoadRequested()),
  expect: () => [LoadingState(), LoadedState(data)],
);

Resources

  • Extensions → lib/core/utils/extensions/
  • Helpers → lib/core/utils/helpers/
  • Validators → lib/core/utils/validators/

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