# configuring-codemagic

Adopt this skill: https://proskills.md/skills/other/poorgramer-zack-dart-expert-skills-skills-codemagic

Page: https://proskills.md/skills/other/poorgramer-zack-dart-expert-skills-skills-codemagic
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/codemagic/SKILL.md
size: 5407
sha: 531d3a03cd998396603525ae9e0809187802a209
upstream: https://github.com/poorgramer-zack/dart-expert-skills/blob/main/skills/codemagic/SKILL.md

````text
---
name: "configuring-codemagic"
description: "Configures Codemagic CI/CD pipelines for Flutter using `codemagic.yaml`. Use when setting up automated Flutter builds on Codemagic, configuring iOS code signing without Fastlane Match, deploying to App Store Connect or Google Play from Codemagic, caching pub dependencies in Codemagic, setting up encrypted environment variable groups, running tests with Codemagic's test dashboard, or choosing between Codemagic and GitHub Actions + Fastlane for a Flutter CI/CD pipeline."
metadata:
  last_modified: "2026-04-01 14:35:00 (GMT+8)"
---

# Flutter combined with Codemagic Best Practices (YAML approach)

## Goal
Implements Codemagic YAML configurations for Flutter deployment. [Codemagic](https://codemagic.io/) natively understands Flutter, requires no extra tooling for code signing, and provides Apple M-series machines for fast iOS compilation.

## Instructions

The recommended approach is using `codemagic.yaml` for "Infrastructure as Code," maintaining it within the project repository alongside the source code.

### 1. Infrastructure and Cache Strategy
Place `codemagic.yaml` in the project root. A single file can contain multiple Workflows (e.g., executing iOS deployments and Android deployments separately).

**Best Caching Practice**: Caching is fundamental to saving CI costs. Be sure to cache Dart dependencies and native build tools.

```yaml
# 🌟 codemagic.yaml
workflows:
  android-release:
    name: Android Release Workflow
    instance_type: mac_mini_m2 # Apple M2 build machine (verified against Codemagic docs)
    environment:
      # 🌟 Specify the Flutter version
      flutter: stable 
    cache:
      cache_paths:
        - $HOME/.pub-cache # Dart packages
        - $HOME/.gradle/caches # Gradle dependencies
```

### 2. Environment Variables & Encrypted Keys
**NEVER** hardcode Keystore passwords or API Keys in the YAML file. Codemagic provides highly secure UI dashboards to create variable groups, encrypt them, and consume them via scripts.

```yaml
    environment:
      flutter: stable
      groups:
        # Pre-configured group names on the Codemagic UI
        - keystore_credentials # Contains $KEY_PASSWORD, $ALIAS_PASSWORD
        - google_play_credentials # Contains the JSON key path for the Google Service Account
```

### 3. Analyze, Generate & Test
Before building, utilize the `scripts` block to execute commands sequentially.

```yaml
    scripts:
      - name: ⬇️ Fetch Dependencies
        script: flutter packages pub get
        
      - name: ⚙️ Code Generation (build_runner)
        script: dart run build_runner build
        
      - name: 🚨 Static Analysis
        script: flutter analyze
        
      - name: 🧪 Unit & Widget Tests
        script: |
          mkdir -p test-results
          flutter test --machine > test-results/flutter.json
        # 🌟 Codemagic parses the Flutter --machine JSON and shows the results in the build overview
        test_report: test-results/flutter.json
```

### 4. Build Bundle / IPA
Codemagic's greatest strength lies in condensing complex Code Signing flows into extremely minimalist declarative syntax.

#### 4.1 Android Building (with Keystore)

```yaml
      - name: 🔨 Build Android App Bundle
        script: |
          # Generate a key.properties for android/app/build.gradle to read
          echo "storePassword=$KEYSTORE_PASSWORD" >> android/key.properties
          echo "keyPassword=$KEY_PASSWORD" >> android/key.properties
          echo "keyAlias=$KEY_ALIAS" >> android/key.properties
          echo "storeFile=$KEYSTORE_PATH" >> android/key.properties
          
          # 🌟 The build action
          flutter build appbundle --release
```

#### 4.2 iOS Code Signing
You typically do not need to manually configure Fastlane Match. Upload your `App Store Connect API Key` via Codemagic's Web Dashboard, and it automatically handles certificate fetching:

```yaml
    environment: # Declare before Workflow logic: Enable Auto Signing
      ios_signing:
        distribution_type: app_store
        bundle_identifier: com.yourcompany.app

    scripts:
      - name: 🍏 Build iOS IPA
        script: flutter build ipa --release
```

### 5. Push to Store (Publishing)
Once the build concludes, declare the target artifacts, and automatically push directly to the stores utilizing built-in modules—no upload scripting required!

```yaml
    artifacts:
      - build/app/outputs/bundle/release/**/*.aab
      - build/ios/ipa/*.ipa

    publishing:
      # Auto-email the team
      email:
        recipients:
          - devteam@company.com
          
      # 🌟 Publish to Google Play (Internal Track)
      google_play:
        credentials: $GCP_SERVICE_ACCOUNT_CREDENTIALS # The JSON key variable
        track: internal
        
      # 🌟 Publish to App Store Connect / TestFlight
      app_store_connect:
        auth: integration # Corresponds to the integrated Apple account from the Dashboard
        submit_to_testflight: true
```

## Constraints
*   Prefer `codemagic.yaml` over the Codemagic UI workflow editor — keeping pipeline configuration in the repository alongside source code is the recommended "Infrastructure as Code" approach.
*   For teams already using Fastlane, Codemagic can still call `bundle exec fastlane <lane>` from its `scripts` block; the two tools are not mutually exclusive.
````

## File: README.md
upstream: https://github.com/poorgramer-zack/dart-expert-skills/blob/main/README.md

````text
# Dart Expert Skills 🚀

A comprehensive library of modular AI Skills for Flutter & Dart development, designed for precise, production-ready AI Agent workflows. Each skill provides structured knowledge and expert-level guidance optimized for LLM consumption and human readability.

---

## 🏗️ Skill Architecture

All skills follow a modular, flat structure for maximum clarity and AI compatibility.

### Directory Structure
```text
skills/
└── <skill-name>/
    ├── SKILL.md        # Entry point: Goals, Process, Constraints
    └── references/     # Detailed implementation guides
```

### Core Design Principles
1. **Single Responsibility**: Each skill focuses on one technology or framework
2. **LLM-Optimized**: Documents are structured for AI context windows with semantic headings
3. **Production-Ready**: Working code snippets, not placeholders
4. **Version-Aware**: All packages use latest stable versions (as of 2026-03-31)

---

## 📚 Skill Categories

### State Management
- **`flutter-provider`**: Provider (v6.1.5+1) - ChangeNotifier + MVVM with memory leak prevention and disposal patterns
- **`flutter-riverpod`**: Riverpod (v3.3.1) - Riverpod 3.0 compile-safe reactive state; `Consumer` scoped rebuilds; generic providers; mutations & offline persistence (experimental)
- **`flutter-bloc`**: BLoC (v9.1.1) - Event-driven architecture with transformers and Freezed integration

### Database & Storage
- **`flutter-shared-preferences`**: SharedPreferences (v2.5.5) - Simple key-value for non-sensitive settings
- **`flutter-secure-storage`**: SecureStorage (v10.0.0) - Encrypted storage with biometric support, iOS Keychain & Android Keystore
- **`flutter-hive`**: Hive CE (v2.19.x) - High-performance NoSQL object storage
- **`flutter-drift`**: Drift (v2.32.x) - Type-safe reactive SQL with WAL mode and sqlite3 v3.x

### Routing & Navigation
- **`flutter-gorouter`**: GoRouter (v17.1.0) - Official declarative routing with deep linking and redirect loop prevention
- **`flutter-autoroute`**: AutoRoute (v11.1.0) - Type-safe routing with code generation

### Authentication & Social Login
- **`flutter-social-auth`**: OAuth/SSO for Google, Apple, Facebook, LINE with error handling and common gotchas
- **`flutter-deeplink`**: App Links and Universal Links configuration

### Advanced Features
- **`flutter-expert`**: Architecture decision matrix, Clean/Feature-First patterns, performance optimization
- **`flutter-responsive`**: Multi-screen layouts with breakpoints
- **`flutter-animate`**: High-performance animations and physics-based effects
- **`flutter-hooks`**: Functional widget lifecycle management
- **`flutter-isolate`**: Concurrency with ReceivePort cleanup and memory leak prevention
- **`flutter-testing`**: Unit, widget, integration, golden tests with CI/CD troubleshooting
- **`flutter-genui`**: AI-powered UI generation
- **`marionette`**: AI-driven Flutter E2E testing via VM Service CLI — tap, scroll, enterText, screenshot on live debug builds

### UI Components & Theming
- **`shadcn-flutter`**: Modern accessible UI components with theming
- **`effective-dart`**: Dart 3.10 best practices — dot shorthands, null-aware collection elements, wildcard variables, records, patterns, sealed classes

### Data Visualization
- **`fl-chart`**: FL Chart (v1.2.0) — Line, Bar, Pie, Scatter, Radar, Candlestick charts with implicit animations, touch tooltips, and pan/zoom transformations

### Backend Integration
- **`supabase`**: Realtime Postgres, Edge Functions, Authentication
- **`serverpod`**: Full-stack Dart server with type-safe endpoints
- **`firebase`**: Analytics, Crashlytics, Authentication, Storage

### Utilities & Tools
- **`freezed`**: Immutable models and union types with pattern matching
- **`fpdart`**: Functional programming (Option, Either, Task)
- **`openapi-to-dart`**: Manual Dart API client implementation from OpenAPI specs using Dio + Equatable/Freezed
- **`ts-to-dart`**: TypeScript to Dart conversion utilities
- **`sentry-flutter`**: Error tracking and performance monitoring
- **`revenuecat-flutter`**: Subscription billing and payment integration
- **`flutter-ads`**: AdMob monetization and mediation

### Web Development
- **`jaspr`**: Dart-only SSR/SPA web framework

### DevOps & CI/CD
- **`flutter-setup`**: Environment setup with PATH configuration and troubleshooting for macOS/Linux/Windows
- **`github-actions`**: CI/CD automation workflows
- **`fastlane`**: Automated deployment pipelines
- **`codemagic`**: Cloud CI/CD for Flutter apps

---

## 🔌 Official Flutter Agent Plugins

These skills work well alongside the official plugins and skills from the Flutter and Dart teams:

- **[flutter/agent-plugins](https://github.com/flutter/agent-plugins)**: Agent plugins maintained by the Flutter team. Each plugin bundles skills, MCP server configuration, and rules. Install them for your agent by following [Get started developing with AI](https://docs.flutter.dev/ai/get-started).
- **[dart-lang/skills](https://github.com/dart-lang/skills)**: Dart-language skills recommended by the agent-plugins README.

Use the official plugins for general Flutter workflows, and the skills in this repository for the specific packages and patterns listed above. If an official skill and a local skill disagree on a package API, check the installed package version first.

---

## 🎯 Development Philosophy

> "Simplicity is the ultimate sophistication."

- **Minimalist Approach**: Focus on user experience, not engineering abstractions
- **Modern Best Practices**: Latest stable releases with version documentation
- **Type Safety**: Leverage Dart 3+ features (pattern matching, records, sealed classes)
- **Zero Placeholder Policy**: All code snippets are production-ready

---

## 🚀 Recent Updates (2026-04-02)

### fl-chart — Flutter Data Visualization (v1.2.0)
- ✅ **6 chart types**: LineChart, BarChart, PieChart, ScatterChart, RadarChart, CandlestickChart
- ✅ **Quick start examples** for all chart types with production-ready code
- ✅ **Common config patterns**: titles/axes, grid, border, extra lines, touch interactivity, animations, pan/zoom
- ✅ **Advanced patterns**: stacked bars with per-layer tooltip, multi-series gradient lines, donut chart touch expansion, multi-dataset radar overlay, horizontal bar rotation
- ✅ **7 reference files**: full API property tables for each chart type + shared base components

### Previous Updates (2026-04-01)

### Fleet Mode Quality Audit — All 36 Skills
- ✅ **36 SKILL.md files** audited and standardized to Agent Skill Best Practices
- ✅ **Gerund naming** enforced (`applying-*`, `managing-*`, `testing-*`)
- ✅ **Third-person descriptions** with trigger keywords for precise AI activation
- ✅ **500-line limit** enforced — `flutter-bloc` (594→147 lines) and `flutter-riverpod` (625→162 lines) split with new `references/` files

### Riverpod 3.0 Full Coverage
- ✅ **Breaking changes**: `==` equality for all state comparisons, fresh Notifier instances on rebuild (resource leak risk), `FamilyNotifier` removed, `Ref` generics removed
- ✅ **Consumer vs ConsumerWidget**: decision table; prefer `Consumer` + `ref.watch().select()` for surgical rebuilds
- ✅ **New APIs**: generic providers, `@Dependencies` scoping, `AsyncValue` sealed + `progress`, weak listeners, `overrideWithBuild`
- ✅ **Mutations (experimental)**: `tsx.get()` pattern, exhaustive 4-state switch (`Idle/Pending/Error/Success`)
- ✅ **Offline Persistence (experimental)**: `riverpod_sqflite`, `persist()` in `build()`, `StorageOptions`

### effective-dart — Dart 3.7–3.10 Features
- ✅ **Dot shorthands** (3.10): `.blue` instead of `Color.blue`, `.all(16)` instead of `EdgeInsets.all(16)`
- ✅ **Null-aware collection elements** (3.8): `[?nullable]` auto-excludes nulls
- ✅ **Wildcard variables** (3.7): non-binding `_`, multiple `_` in same scope
- ✅ **New lints** (3.9): `switch_on_type`, `unnecessary_unawaited`, `@awaitNotRequired`

### openapi-to-dart — Reframed as Manual Implementation Guide
- ✅ Removed code-generation f
````
