flutter avatar

Flutter Apply Architecture Best Practices

Think of this as a guide for laying out a Flutter app before the code gets messy. It splits the app into three layers: UI (MVVM, with lean Views and ChangeNotifier-based ViewModels), Data (Services wrapping APIs, Repositories as the single source of truth that turn API models into domain models), and an optional Logic layer of Use Cases you only add when business logic starts cluttering ViewModels. The folder layout groups UI by feature and data/domain by type. It also walks through a sequenced checklist for adding a feature, with a test-and-fix loop at the end. Reach for it when starting a new project or untangling a growing one. The main caveat is that it's opinionated: the Repository caching example is minimal, and you'll still need to decide on your own DI container and error-handling strategy.

skills.sh installs
45.5K
GitHub stars
3.2K
last updated
Oct 26, 2026

Install

$ npx -y skills add flutter/agent-plugins --skill flutter-apply-architecture-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

Architecting Flutter Applications

Contents

Architectural Layers

Enforce strict Separation of Concerns by dividing the application into distinct layers. Never mix UI rendering with business logic or data fetching.

UI Layer (Presentation)

Implement the MVVM (Model-View-ViewModel) pattern to manage UI state and logic.

  • Views: Write reusable, lean widgets. Restrict logic in Views to UI-specific operations (e.g., animations, layout constraints, simple routing). Pass all required data from the ViewModel.
  • ViewModels: Manage UI state and handle user interactions. Extend ChangeNotifier (or use Listenable) to expose state. Expose immutable state snapshots to the View. Inject Repositories into ViewModels via the constructor.

Sponsors

Details

Repository
github.com/flutter/agent-plugins
Categories
Code Review & Quality, AI & Agent Building, Mobile Development
First seen
Oct 26, 2026

More from flutter/agent-plugins

All 10
1samber avatargolang-lintsamber/cc-skills-golangLinting best practices and golangci-lint configuration for Golang projects — running linters, configuring .golangci.yml, suppressing warnings with nolint direct41.9Kskills.sh installs
2addyosmani avatarweb-quality-auditaddyosmani/web-quality-skillsComprehensive web quality audit covering performance, accessibility, SEO, and best practices. Use when asked to "audit my site", "review web quality", "run ligh36.1Kskills.sh installs
3wshobson avatararchitecture-patternswshobson/agentsImplement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing cle25.1Kskills.sh installs
4github avatarrefactorgithub/awesome-copilotSurgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, im22.6Kskills.sh installs
5coderabbitai avatarcode-reviewcoderabbitai/skillsAI-powered code review using CodeRabbit. Default code-review skill. Trigger for any explicit review request AND autonomously when the agent thinks a review is n16Kskills.sh installs
6github avatarpostgresql-code-reviewgithub/awesome-copilotPostgreSQL-specific code review assistant focusing on PostgreSQL best practices, anti-patterns, and unique quality standards. Covers JSONB operations, array usa12.8Kskills.sh installs