

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# Agent Guide for the Flutter Packages Repository23This document provides guidance for AI agents to effectively contribute to the `flutter/packages` repository.45## Guiding Principles for Contributions67- **Format All Code**: Every code change must be formatted using the repository's tools.8- **Pass All Tests**: All changes must pass linting, analysis, and relevant tests.9- **Update CHANGELOGs**: Any user-facing change or bug fix in a package requires an update to its `CHANGELOG.md` and `pubspec.yaml` version. Ensure you follow the [CHANGELOG style guide](https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changelog-style).10- **Follow Conventions**: Adhere to the repository's specific conventions, such as federated plugin structure and code generation steps.1112## Agent Environment Setup1314To ensure a consistent and functional environment, configure your VM with the following setup. This provides the necessary Flutter SDK and dependencies for building and testing packages.1516```bash17curl -L https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.32.8-stable.tar.xz | tar -xJ -C $HOME18export FLUTTER_HOME=$HOME/flutter19export PATH=$FLUTTER_HOME/bin:$PATH20flutter --disable-analytics21flutter precache --force22# Sanity check the configuration.23flutter doctor --verbose24```2526## Repository Overview2728This is a monorepo containing many Flutter packages.29- First-party packages developed entirely by the Flutter team are in `packages/`.30- Packages that were originally developed by a third party, but are now maintained by the Flutter team are in `third_party/packages/`.31- The repository tooling is in `script/tool/`.3233Many packages are part of **federated plugins**. A federated plugin has a main package (e.g., `path_provider`) that defines the API used by plugin clients, a platform interface package (e.g., `path_provider_platform_interface`) that defines the interface that each platform implementation must implement, and one or more platform implementation packages (e.g., `path_provider_android`, `path_provider_ios`) that implement that platform interface. When working on a federated plugin, you may need to modify multiple packages.3435For more details, see the main `README.md` and `CONTRIBUTING.md`.3637## Core Tooling and Workflows3839The primary tool for this repository is `flutter_plugin_tools.dart`.4041### Initial Setup4243First, define an environment variable for the repository root directory and initialize the tooling:44```bash45# Define an environment variable for the repository root.46export REPO_ROOT=$(pwd)4748# Verify that the environment variable is working correctly.49echo "Repository root directory: $REPO_ROOT"5051dart pub get -C $REPO_ROOT/script/tool52```5354### Identifying Target Packages5556Most tool commands take a `--packages` argument. You must correctly identify all packages affected by your changes. You can derive this from git diff.5758For example, to find changed files against the main branch of the upstream remote (assuming the upstream remote is named `origin`):5960```bash61git diff --name-only origin/main...HEAD62```6364Then, for each file path, find its enclosing package. A package is a directory containing a `pubspec.yaml` file. The directory name is usually the package name. Ignore `pubspec.yaml` files within `example/` directories when determining the package for a file.6566#### Targeting All Packages6768Running a tool command without a `--packages` argument will run the command on all packages. For example, a dependency can be updated for all packages in the repository:6970```bash71dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart update-dependency --pub-package <dependency_name>72```7374### Common Commands7576- **Formatting**: Always format your changes.7778```bash79 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart format --packages <changed_packages>80```81- **Testing**: All changes must pass analysis and tests:8283```bash84 # Run static analysis85 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart analyze --packages <changed_packages>86 # Run Dart unit tests87 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart dart-test --packages <changed_packages>88```8990 The tool can also run native and integration tests, but these may require a more complete environment than is available.91- **Validation**: Run these checks to ensure that changes follow team guidelines:92```bash93 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart validate --packages <changed_packages>94 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart publish-check --packages <changed_packages>95 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart license-check96```9798### Specialized Workflows99100- **Federated Plugin Development**: If you change multiple packages in a federated plugin that depend on each other, use `make-deps-path-based` to make their pubspec.yaml files use `path:` dependencies. This allows you to test them together locally.101```bash102 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart make-deps-path-based --target-dependencies=<changed_plugin_packages>103```104105 The CI system will run tests with path-based dependencies automatically, so this is not required for PRs, but can be useful for local testing.106- **Updating Dependencies**: To update a dependency across multiple packages:107```bash108 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart update-dependency --pub-package <dependency_name> --packages <packages_to_update>109```110- **Updating README Code Samples**: If you change example code that is included in a README.md:111```bash112 dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart update-excerpts --packages <changed_packages>113```114115## Code Generators116117Some packages use code generators, and changes to those packages require running the relevant code generators.118119- **Pigeon**: If you change a file in a `pigeons/` directory, you must run the Pigeon generator:120```bash121 # Run from the package's directory122 dart run pigeon --input pigeons/<changed_file>.dart123```124- **Mockito**: If you change code in a package that uses `mockito` for tests (check `dev_dependencies` in `pubspec.yaml`), you must run its mock generator:125```bash126 # Run from the package's directory127 dart run build_runner build -d128```129130## Code Style131132All code must adhere to the repository's style guides. The `format` command handles most of this, but be aware of the specific style guides for each language, as detailed in [CONTRIBUTING.md](./CONTRIBUTING.md#style):133- **Dart**: Flutter style, formatted with `dart format`.134- **C++**: Google style, formatted with `clang-format`.135- **Java**: Google style, formatted with `google-java-format`.136- **Kotlin**: Android Kotlin style, formatted with `ktfmt`.137- **Objective-C**: Google style, formatted with `clang-format`.138- **Swift**: Google style, formatted with `swift-format`.139- **Comments**: Avoid adding redundant or trivial comments that simply restate what the code itself does (e.g., repeating method calls in English). Comments should explain the *why* behind complex or non-obvious logic, or serve as public API documentation.140141## Version and CHANGELOG updates142143Any PR that changes non-test code in a package should update its version in pubspec.yaml and add a corresponding entry in CHANGELOG.md.144145**This process can be automated**. The `update-release-info` command is the preferred way to handle this. It determines changed packages, bumps versions, and updates changelogs automatically.146```bash147dart run $REPO_ROOT/script/tool/bin/flutter_plugin_tools.dart update-release-info \148 --version=minimal \149 --base-branch=origin/main \150 --changelog="A description of the changes."151```152153- `--version=minimal`: Bumps patch for bug fixes, and skips unchanged packages. This is usually the best option unless a new feature is being added.154 - When making public API changes, use `--version=minor` instead.155- `--base-branch=origin/main`: Diffs against the `main` branch to find changed packages.156157If you update manually, follow semantic versioning and the [repository's CHANGELOG style](https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changelog-style).158
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| flutter/packagespackages/camera/camera_android_camerax/AGENTS.md · 5.3k | AGENTS.md | testing-strategydo-notagent-behaviour | 61/100 | 13 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 200k | AGENTS.md | buildteststylearch+3 | 100/100 | 14 days ago | |
| aaif-goose/gooseAGENTS.md · 53k | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 8 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 14 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 14 days ago | |
| vllm-project/vllmAGENTS.md · 88k | AGENTS.md | setuptestlint-formatstyle+5 | 100/100 | 14 days ago | |
| elastic/elasticsearchx-pack/plugin/inference/AGENTS.md · 78k | AGENTS.md | buildtestlint-formatstyle+3 | 100/100 | 14 days ago | |
| rails/railsAGENTS.md · 59k | AGENTS.md | teststylearchgit+4 | 100/100 | 14 days ago | |
| wpscanteam/wpscanAGENTS.md · 9.7k | AGENTS.md | setupbuildteststyle+6 | 100/100 | 13 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/flutter-packages-agents)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.