AgentSkillsCN

Flutter Architecture

Flutter架构

SKILL.md

Flutter Architecture Skill

Overview

This skill documents the OneMind app architecture patterns for Flutter + Riverpod + Supabase. Use this when:

  • Creating new features
  • Reviewing PRs
  • Debugging state management issues
  • Onboarding to the codebase

Architecture Layers

code
┌─────────────────────────────────────┐
│             UI (Screens)            │
│      ref.watch(xxxProvider)         │
├─────────────────────────────────────┤
│        Providers (providers.dart)   │
│    StateNotifierProvider.family     │
├─────────────────────────────────────┤
│      Notifiers (StateNotifier)      │
│   AsyncValue<State>, Equatable      │
├─────────────────────────────────────┤
│         Services (xxxService)       │
│   Supabase queries, domain models   │
├─────────────────────────────────────┤
│       Models (Equatable, fromJson)  │
│     Domain objects, fail-fast       │
├─────────────────────────────────────┤
│            Supabase                 │
│   PostgreSQL + Realtime + Auth      │
└─────────────────────────────────────┘

Key Files

LayerLocationPattern
Providerslib/providers/providers.dartCentral barrel file
Notifierslib/providers/notifiers/*.dartStateNotifier + AsyncValue
Serviceslib/services/*.dartSupabase injection
Modelslib/models/*.dartEquatable + fromJson
Errorslib/core/errors/app_exception.dartError hierarchy

Quick Reference

See:

  • PATTERNS.md - Detailed pattern descriptions
  • EXAMPLES.md - Code examples
  • CHECKLIST.md - PR review checklist