# Set Up Dependabot for a Flutter App's Pub, Gradle and Actions Dependencies

Yes. An agent reads your Flutter app's pubspec pins, Android Gradle plugins and workflow actions, writes a dependabot.yml grouping each ecosystem, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-dependabot/flutter/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent starts by listing what Dependabot would have to watch, which in a Flutter app is three ecosystems. In an app like simplezhli/flutter_deer, `pubspec.yaml` mixes styles: exact pins such as `url_launcher: 6.3.0`, `image_picker: 1.2.0`, `webview_flutter: 4.13.0`, `device_info_plus: 11.5.0` and `window_manager: 0.5.2`, caret ranges such as `dio: ^5.9.0`, `provider: ^6.1.2` and `intl: ^0.20.2`, one git dependency, `flutter_2d_amap`, fixed to a commit `ref`, and a `dependency_overrides` block for `scrollable_positioned_list`. The SDK constraints are Dart `>=3.4.0 <4.0.0` and Flutter `>=3.19.0`. `.gitignore` has `*.lock`, so there is no `pubspec.lock` in the repository and every fresh checkout resolves anew.

Under `android/`, `settings.gradle` declares `com.android.application` `9.1.0` and `org.jetbrains.kotlin.android` `2.4.0` in its `plugins` block, `gradle/wrapper/gradle-wrapper.properties` points at Gradle `9.3.1`, and `app/build.gradle` sets `compileSdkVersion` and an `ndkVersion`. Under `.github/workflows`, `flutter-drive.yml` uses `actions/checkout@v3`, `actions/setup-java@v3`, `subosito/flutter-action@v2` pinned to Flutter `3.47.4`, `futureware-tech/simulator-action@v2` and `reactivecircus/android-emulator-runner@v2`, while `flutter-web-deploy.yml` still uses `actions/checkout@v2.3.1` and `JamesIves/github-pages-deploy-action@4.0.0`. There is no `.github/dependabot.yml`.

The agent writes one with three entries. `pub` on `/`, weekly, with `versioning-strategy: increase-if-necessary` so the exact pins move with each release and the caret ranges are only widened when a release falls outside them, a `flutter-packages` group for the `flutter/packages` plugins (`url_launcher`, `image_picker`, `webview_flutter` and its `wkwebview` sibling, `quick_actions`) that tend to release together, and an `ignore` for `intl`, whose version is tied to `flutter_localizations` in the installed SDK and cannot be bumped independently. `gradle` on `/android`, monthly, covering the two plugin versions in `settings.gradle` and the wrapper. `github-actions` on `/`, weekly, grouped so the half-dozen actions arrive as one pull request. Each entry has a label and a `commit-message` prefix the team can filter on, and `open-pull-requests-limit` keeps the first week to a handful.

Then it checks what a Dependabot pull request will trigger, because that decides whether the setup is useful or noisy. `flutter-drive.yml` runs on every `push` and `pull_request` and spins up an iOS simulator and an Android emulator for driver tests, which is a lot of macOS minutes per dependency bump; only its `accessibility_test` job runs `flutter pub get` and a `flutter test`. The agent proposes, in a separate commit, a lighter `pub-check.yml` that runs on pull requests touching `pubspec.yaml`: `flutter pub get`, `flutter analyze` and `flutter test`, enough to tell a safe bump from a broken one. In the sandbox it installs the pinned Flutter, runs `flutter pub get` to confirm today's constraints resolve, validates the new `dependabot.yml` against its published schema, and lists the packages `flutter pub outdated` reports so the description predicts the first pull requests.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Set up Dependabot for this Flutter app. Read pubspec.yaml, .gitignore, android/settings.gradle, android/app/build.gradle, android/gradle/wrapper/gradle-wrapper.properties and every workflow under .github/workflows first, and note which pub dependencies are pinned exactly, which use ranges, which is a git dependency, which is overridden, and which actions the workflows use. Write .github/dependabot.yml with a pub entry on the root using versioning-strategy increase-if-necessary and a group for the flutter/packages plugins, an ignore for intl because it is tied to the SDK, a gradle entry on the android directory, and a github-actions entry, each with labels, commit message prefixes and a pull request limit. Explain in the description which existing workflow jobs a Dependabot pull request will trigger and, in a separate commit, add a lightweight workflow that runs flutter pub get, flutter analyze and flutter test on pull requests that change pubspec.yaml. Install the Flutter version the workflow pins, run flutter pub get and flutter pub outdated, validate the dependabot.yml against its schema, and open a pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch with `.github/dependabot.yml` in the first commit and a new `.github/workflows/pub-check.yml` in the second, so the team can take the configuration alone and keep running the driver tests on every bump if they prefer. No existing file is changed and no dependency is bumped by this pull request itself.

The description explains each entry and each group in a sentence, lists what `flutter pub outdated` reported so the first Dependabot pull requests are no surprise, states that the git dependency and the override will not be touched, and names which jobs in `flutter-drive.yml` will run on a Dependabot branch and roughly what they cost in runner time. The transcript at `GET /o/{org}/sessions/{id}/messages` keeps the `pub get`, `pub outdated` and schema validation output.

Before merging, a reviewer decides two things the agent flags: whether `flutter-drive.yml` should gain a `paths-ignore` for `pubspec.yaml` so dependency bumps run only the light check, and whether any of the exact pins were deliberate, in which case an `ignore` line is a one-line addition. After the merge, the Dependabot tab shows the three ecosystems and the first run.

## Run it on every Flutter repository you maintain

A team with several Flutter apps starts one run per repository with one `POST /o/{org}/sessions` each, the repository in `resources` and this prompt as `input`. Each run reads that app's own `pubspec.yaml`, Gradle files and workflows, so an app with no Android directory gets no `gradle` entry and an app with a `pubspec.lock` committed gets a configuration that respects it.

A key may have at most `max_concurrent` runs in progress at once, four by default, and a loop over more Flutter repositories can send them all without waiting: each extra run is created, answered `202` with `status: "queued"`, and started oldest first when a slot frees. Send a `request_id`, one UUID per repository, so a retried call returns the run it already started.

## Why run it on Rush?

A Flutter app has dependencies in three places with three update tools, and the pub side has rules of its own: `intl` follows the SDK, plugins from `flutter/packages` move together, a git dependency never moves, and an app without a lockfile resolves differently on every machine. Getting a `dependabot.yml` right means reading all of that first, which is exactly the hour nobody spends.

The agent reads it, writes a configuration that matches this app, and checks in a sandbox with the pinned Flutter that the constraints resolve today and what will move first. The pull request also says what each Dependabot bump will cost in CI, so the team sees the trade-off before the first simulator job starts on a patch release.

## Frequently asked questions

### There is no pubspec.lock. Does Dependabot still work?

Yes. With `*.lock` ignored, Dependabot updates the constraints in `pubspec.yaml` instead of a lockfile. `increase-if-necessary` keeps the ranges as they are until a release leaves them and bumps the exact pins on each release. The description notes that committing `pubspec.lock` would make builds reproducible and let Dependabot update the lock alone, a choice left to the team.

### Why is intl ignored?

Because `flutter_localizations` from the installed SDK depends on a specific `intl` version, so a bump that `pub get` cannot resolve against the pinned Flutter would fail every time. The ignore is removed when the app moves to a Flutter release that ships the newer `intl`; the agent says so in a comment beside the line.

### What about the git dependency and the override?

`flutter_2d_amap` is fixed to a commit `ref` in a git source, which Dependabot's pub updater does not move, and `scrollable_positioned_list` sits under `dependency_overrides`, which it leaves alone too. Both are listed in the description as the ones to review by hand when the rest is updated.

### Will every Dependabot pull request run the simulator and emulator jobs?

As the workflows stand, yes: `flutter-drive.yml` triggers on every `pull_request`. The second commit adds a light workflow for `pubspec.yaml` changes, and the description suggests a `paths-ignore` on the driver workflow so bumps run only that check, a change the agent leaves to the reviewer because it changes what CI covers.

## More Flutter jobs

- [Add Fastlane to a Flutter App](https://getrush.ai/run/add-fastlane/flutter/)
- [Add GitHub Actions CI to a Flutter App](https://getrush.ai/run/add-github-actions-ci/flutter/)
- [Add i18n to a Flutter App](https://getrush.ai/run/add-i18n/flutter/)

## The same job on other stacks

- [Add Dependabot to a Go CLI Repository](https://getrush.ai/run/add-dependabot/go-cli/)
- [Add Dependabot to a Gradle Project](https://getrush.ai/run/add-dependabot/gradle/)
- [Add Dependabot to a Jekyll Site](https://getrush.ai/run/add-dependabot/jekyll/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
