Key takeaways
- flutter analyze and flutter test give Codex fast, deterministic feedback – make both mandatory in AGENTS.md.
- Codex cloud can run Dart tests and Android builds after the setup script installs Flutter; iOS builds still need a Mac.
- Name your state management approach and folder structure, or the agent will mix patterns.
- New pub packages, platform channel code and native project files deserve a human review every time.
- The Dart and Flutter MCP server gives Codex Flutter-aware tools, but it is still marked experimental.
Where Codex is strong in Flutter – and where to look twice
Flutter is a friendly environment for a coding agent. Most of the app is Dart, the analyzer is strict and fast, and widget tests run without a device. The risk sits where Flutter meets the platforms and the package ecosystem:
| Area | Codex is usually reliable at | Check yourself |
|---|---|---|
| Widgets and layout | Composing and extracting widgets, applying the theme | Overflow on small screens, large text scaling, right-to-left layouts |
| State management | Following the pattern the project already uses | Mixed patterns, needless rebuilds in long lists |
| Models and serialization | Code-generated models and JSON mapping | Generated files that are stale or edited by hand |
| Tests | Unit and widget tests, fakes for repositories | Golden images, which differ between operating systems |
| Platform channels | The Dart side and interface definitions | Swift and Kotlin implementations, threading, permissions |
| pub packages | Using well-known packages correctly | Choosing new ones, licences, native setup steps |
The right-hand column is your review list. Everything in the middle column can be left to the analyzer and the tests – provided you make them part of every task.
A Codex cloud environment with the Flutter SDK
Codex cloud tasks run in Linux containers. The setup script has internet access; the agent phase, by default, does not. So the script must install Flutter and fetch every package before the agent starts:
#!/usr/bin/env bash
set -euo pipefail
# Clone the exact Flutter release your team uses, not whatever "stable" is today
git clone https://github.com/flutter/flutter.git --branch <your-flutter-version> --depth 1 "$HOME/flutter"
export PATH="$HOME/flutter/bin:$PATH"
flutter config --no-analytics
flutter --version
flutter pub get
dart run build_runner build --delete-conflicting-outputs # only if the project uses code generation
flutter test # warms caches and proves the setup works
Add the Flutter bin folder to PATH in the environment settings as well, because exports in the setup script may not reach the agent's shell. Pinning the version keeps the analyzer's opinion identical in the cloud, on laptops and in CI – otherwise a task can "fix" lints that your local Flutter does not report.
The container can also build an Android APK if you install the Android SDK, but most tasks do not need it. flutter analyze and flutter test catch nearly everything a cloud task can usefully verify. iOS builds need macOS and Xcode, which the cloud does not have; use the Codex CLI on a Mac or a macOS CI runner for those.
Talk to an AI Code Engineer about shipping your app to the App Store and Google Play.
In a free call we look at what you built, tell you honestly what stands between it and an approved release – and whether you need us at all.
AGENTS.md for a Flutter repository
Flutter allows several equally valid architectures. Your AGENTS.md picks one, so the agent does not reach for the pattern it saw most often:
# AGENTS.md – Flutter app
## Verify before you finish
- dart format --set-exit-if-changed lib test
- flutter analyze (must report no issues; analysis_options.yaml is the source of truth)
- flutter test
- After editing annotated model classes: dart run build_runner build --delete-conflicting-outputs
- In cloud tasks use flutter pub get --offline; the network is off after setup.
## Architecture
- State management: Riverpod with code generation. Do not introduce Provider, Bloc or GetX.
- Folders: lib/features/<feature>/data, domain, presentation
- Navigation: go_router; all routes are declared in lib/app/router.dart.
- User-facing text: lib/l10n/app_en.arb plus flutter gen-l10n. No string literals in widgets.
## Dependencies
- No new pub packages without approval. Proposals name the publisher, supported platforms and any native setup.
## Native code
- Change ios/ and android/ only when the task says so.
- Platform channels are defined with Pigeon in pigeons/. Regenerate; never hand-edit generated files.
- Never change bundle IDs, applicationId, signing, Info.plist usage strings or manifest permissions.
The analyzer is the agent's best teacher. When Codex uses an API that a newer Flutter version deprecated, flutter analyze flags it and dart fix --apply can often migrate it mechanically – which is why the "no issues" rule belongs in the definition of done.
Flutter-aware tools: the Dart and Flutter MCP server
The Dart SDK ships an MCP server that exposes Dart and Flutter tooling to agents. It needs Dart 3.9 or later and is still labelled experimental in the Flutter documentation. Adding it to the Codex CLI on your machine is one command:
codex mcp add dart -- dart mcp-server
The server gives the agent structured access to analysis, formatting, tests and pub.dev search, and – with a running app – to inspection of the widget tree. That last part is where it adds the most: the agent can look at the actual layout instead of guessing from code. As with any MCP server, review what it can do before you allow its tools without approval; our guide to MCP servers for mobile development covers the safety side.
pub packages and platform channels need a second look
Packages. An agent that needs a feature reaches for a package, sometimes one that is unmaintained, sometimes one whose name it half-remembers. Before you approve a new dependency, check its pub.dev page: the publisher, the supported platforms, recent releases and the licence. Plugins with native code also change your store paperwork – a new analytics or ads SDK affects the App Store privacy details, the privacy manifest and the Google Play Data safety form. flutter pub outdated helps the agent propose upgrades in reviewable batches.
Platform channels. Codex writes both sides of a channel convincingly, but in a Linux container it cannot compile the Swift side, and it rarely tests threading on the Kotlin side. Pigeon-generated interfaces reduce the risk of mismatched messages. Every channel change should be built on both platforms before merge – on a Mac for iOS.
Release builds: what runs where
| Build | Command | Where |
|---|---|---|
| Android App Bundle | flutter build appbundle --release | Linux or macOS, with the upload key from CI secrets |
| iOS archive | flutter build ipa --release | macOS with Xcode 26 and the iOS 26 SDK |
Version and build number come from the version line in pubspec.yaml (for example 2.3.0+41); each store upload needs a higher build number, so let CI set it rather than the agent. If you obfuscate Dart code, keep the split debug info so crash reports stay readable. On Android, check that the target SDK in the Gradle file meets Google Play's requirement of Android 16 (API level 36).
The store-side steps are in Codex app to the App Store and Codex app to Google Play. Our AI Code Engineers can run both releases in your own accounts, or teach your team this workflow in a React Native and Flutter workshop.
Codex for Flutter checklist
- The Flutter version is pinned and identical in the cloud environment, on laptops and in CI.
- The setup script runs flutter pub get, code generation and the tests once.
- AGENTS.md makes dart format, flutter analyze and flutter test part of every task.
- State management, folder structure, routing and localisation rules are written down.
- New pub packages need approval with publisher, platforms and native setup named.
- Platform channel changes are built on both platforms before merge.
- Build numbers and signing are handled by CI, not by the agent.
Frequently asked questions
Can Codex build my Flutter iOS app in the cloud?
No. Codex cloud tasks run on Linux, and iOS builds need macOS with Xcode. The cloud can still analyze and test Dart code. Build iOS with the Codex CLI on a Mac or on a macOS CI runner.
Which state management should I tell Codex to use?
The one your project already uses. Codex can work with Riverpod, Bloc, Provider and others – the problem only starts when a codebase mixes them. Name one in AGENTS.md and point to an existing feature as the example.
Does Codex know the latest Flutter APIs?
Not always; its knowledge has a cut-off date and Flutter keeps deprecating APIs. The analyzer closes the gap: with "no issues" as a rule, deprecated calls show up as warnings the agent has to fix, often with dart fix --apply.
Can you publish our Flutter app to both stores?
Yes. Book a free call and an AI Code Engineer reviews your project. We set up signing and CI/CD for both platforms and handle listings and review in your own Apple and Google accounts.
Free, 15 minutes, no obligation
Get your app from agent output to approved release.
Our AI Code Engineers take apps built with Claude Code, Codex, Cursor, Lovable, Base44 and co. through signing, CI/CD, store listings and review – in your own developer accounts.
AI tools, store policies and requirements change quickly – always check the current documentation of the tools and stores you use. This article is independent advice and not affiliated with or endorsed by Apple, Google, Anthropic, OpenAI or any other company or product mentioned; all trademarks belong to their owners.