Clean Architecture

Generate Flutter feature modules following Clean Architecture with BLoC and repository patterns.

1|Updated Dec 18, 2024
One-click install
npx skills add https://github.com/altrupets/monorepo --skill clean-architecture-altrupets
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Clean Architecture
Source: https://github.com/altrupets/monorepo/tree/main/skills/flutter/clean-architecture
Command: npx skills add https://github.com/altrupets/monorepo --skill clean-architecture-altrupets

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires flutter_bloc, get_it, dartz, http, shared_preferences, internet_connection_checker, equatable, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the complexity of managing large Flutter projects by providing a structured, layered architecture that enhances testability, maintainability, and scalability.

Core Features & Use Cases

  • Layered Architecture: Organizes code into Domain, Data, and Presentation layers with unidirectional dependencies.
  • Dependency Injection: Facilitates easy management and swapping of dependencies using get_it.
  • State Management: Integrates with flutter_bloc for robust state management.
  • Use Case: Generate a new feature module (e.g., 'products') following Clean Architecture principles, including domain entities, repository interfaces, data sources, BLoC, and presentation widgets.

Quick Start

Generate a new feature called 'authentication' using clean architecture with bloc and repository pattern.

Frequently Asked Questions about Clean Architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Flutter app using clean architecture and BLoC?

Structure a Flutter app using clean architecture and BLoC by organizing code into Domain, Data, and Presentation layers with unidirectional dependencies. This enforces strict separation of concerns, making modules highly testable and scalable.

When do I need clean architecture for my Flutter project?

You need clean architecture for your Flutter project when managing large codebases that require enhanced modularity, testability, and maintainability. It solves complexity by enforcing strict dependency rules across separated layers.

Can I use dependency injection with Flutter BLoC and repository patterns?

Yes, you can use dependency injection with Flutter BLoC and repository patterns. The architecture integrates get_it to facilitate easy management and swapping of dependencies alongside flutter_bloc for robust state management.

What is the best way to generate a new feature module in Flutter with DDD?

The best way to generate a new feature module in Flutter with DDD is creating domain entities, repository interfaces, data sources, BLoC, and presentation widgets. This approach strictly follows domain-driven design principles.

Does this clean architecture approach work with dartz and equatable in Flutter?

Yes, this clean architecture approach works with dartz and equatable in Flutter. These dependencies are explicitly supported to handle functional programming patterns and value object equality within the layered architecture.

How do I implement unidirectional dependencies in a Flutter presentation layer?

Implement unidirectional dependencies in a Flutter presentation layer by ensuring it only depends on the domain layer, never on data sources. This separation of concerns allows independent UI testing and development.