agentsclimarketplace

Flutter build performance

Skill almasumdev/awesome-flutter-agent-skills/.github/skills/performance/flutter-build-performance

Curated agent skills, conventions, and workflows for building Flutter apps with AI coding agents.

Install
npx -y skills add almasumdev/awesome-flutter-agent-skills --skill flutter-build-performance

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Debug and optimize flutter build times, codegen (build_runner), and CI pipelines. Use this when builds are slow locally or in CI.

SKILL.md

3.2 KB, as published. Nobody here has run it

Flutter Build Performance

Instructions

Slow builds compound across every edit-run cycle and every CI job. Diagnose before you tweak.

1. Profile the Build

  • Use flutter build apk --verbose / --profile and look for the longest phase (Gradle, Kotlin compile, Dart compile, asset bundling).
  • Gradle: ./gradlew :app:assembleDebug --profile generates an HTML report under build/reports/profile/.
  • For Dart-side iteration: prefer hot reload (r) and hot restart (R) — rebuilding the whole app is almost never necessary during development.

2. Gradle / Android

  • Enable the Gradle build cache and parallel execution in android/gradle.properties:
    org.gradle.parallel=true
    org.gradle.caching=true
    org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
    
  • Keep Android Gradle Plugin and Kotlin up to date (use the versions recommended by the current Flutter stable).
  • Avoid multi-dex unless required; keep minSdk reasonable.
  • Reduce ndk { abiFilters } during local dev (e.g., only your device ABI).

3. iOS / CocoaPods

  • pod install --repo-update only when lockfile changes; otherwise pod install.
  • Commit Podfile.lock. Use use_frameworks! with :linkage => :static to shrink binary and shorten link times.
  • Enable new build system and incremental installs in Xcode. Clean only when necessary (flutter clean invalidates all caches).

4. build_runner Codegen

freezed, json_serializable, drift, retrofit, riverpod_generator all use build_runner.

  • Prefer dart run build_runner watch --delete-conflicting-outputs during development.
  • For one-off: dart run build_runner build --delete-conflicting-outputs.
  • Keep generated files out of version control where possible (add to .gitignore): *.g.dart, *.freezed.dart. Regenerate in CI before tests.
  • Scope builders in build.yaml to narrow globs so unrelated file changes do not retrigger generation.

5. Assets and Fonts

  • Deduplicate images and compress (cwebp, pngquant).
  • Use asset variants (2.0x/, 3.0x/) only for images that need pixel density scaling.
  • Keep pubspec.yaml asset entries specific (list files, not whole folders) to avoid re-bundling everything on any asset change.

6. Dependencies

  • Audit with flutter pub deps and flutter pub outdated.
  • Remove unused packages. Each plugin adds native compile time.
  • Pin heavy dev-only tools (linters, codegen) under dev_dependencies.

7. CI

  • Cache ~/.pub-cache, ~/.gradle/caches, ~/Library/Developer/Xcode/DerivedData (mac runners), and Flutter SDK.
  • Run flutter pub get with a lockfile (pubspec.lock committed for apps, not for packages).
  • Split jobs: analyze + test on Linux, build iOS only when needed.

8. Checklist

  • Gradle parallel + caching enabled.
  • Hot reload works for your feature (no forced full rebuild).
  • build_runner is watched, not re-run manually each time.
  • No unused packages in pubspec.yaml.
  • CI caches Pub, Gradle, and CocoaPods.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.