flutter-app-architecture

Structures Flutter applications using layered MVVM architecture with repositories and dependency injection.

1|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/sohampawar1866/zeromile-go --skill flutter-app-architecture-sohampawar1866
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flutter-app-architecture
Source: https://github.com/sohampawar1866/zeromile-go/tree/main/.agents/skills/flutter-app-architecture
Command: npx skills add https://github.com/sohampawar1866/zeromile-go --skill flutter-app-architecture-sohampawar1866

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Flutter codebases often become tangled when UI, business logic, and data access are mixed together, making apps hard to test and maintain. This Skill provides a clear layered architecture pattern that separates concerns and enforces unidirectional data flow. ## Core Features & Use Cases - Layered Architecture: Separates apps into UI (Views + ViewModels), optional Domain (Use Cases), and Data (Repositories + Services) layers with strict communication rules. - MVVM Implementation: Provides concrete Dart patterns for ViewModels, Repositories as single sources of truth, and stateless Services. - Dependency Injection & Testing: Uses constructor injection with abstract interfaces so implementations can be swapped for testing. - Use Case: When scaffolding a new Flutter feature like a booking system, follow the workflow to create the Service, Repository, ViewModel, and View in the correct order with proper DI wiring. ## Quick Start Ask the AI to scaffold a new Flutter feature with a repository, view model, and view following layered MVVM architecture.

Frequently Asked Questions about flutter-app-architecture

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

FAQPage Schema
How do I structure a Flutter app with MVVM architecture?

Separate the app into a UI layer (Views and ViewModels) and a Data layer (Repositories and Services), adding a Domain layer only for complex logic. State flows down from Data to UI while events flow up, and only adjacent layers may communicate.

What is the role of a Repository in Flutter architecture?

A Repository is the single source of truth and the only class allowed to mutate its data. It handles caching, error handling, and data refresh, transforming raw data from Services into domain models for ViewModels to consume.

When should I add a Domain layer with use cases in Flutter?

Add use cases only when logic is complex, does not fit cleanly in the UI or Data layers, or is reused across multiple ViewModels. A typical case is merging data from multiple Repositories, such as filtering bookings by the current user.

How do I implement dependency injection in Flutter for testability?

Supply dependencies via constructors and define abstract interfaces for repositories so implementations can be swapped in tests. For example, a BookingRepository interface with a BookingRepositoryImpl concrete class allows mock injection during unit testing.

Should a Flutter View ever access a Service directly?

No, the UI layer must never access a Service directly. Views communicate only with ViewModels, which retrieve data from Repositories, which in turn call Services, preserving unidirectional data flow and separation of concerns.