AI Agent Guardrails
Flutter is agent-friendly only when the agent is forced to prove platform and release claims.
Mandatory Rules
| Rule | Why |
|---|---|
| Load current Flutter/Dart docs before API claims | Flutter, Dart, and package APIs move |
| Do not add dependencies without approval or a recorded package gate | Dependencies change platform and release surface |
| Verify plugin platform support before using plugin APIs | Mobile support does not imply desktop/web support |
| Keep platform code behind services/repositories | Tests and unsupported-platform paths stay manageable |
Run flutter analyze and flutter test before done | Static and local behavior gates are baseline |
| Name untested targets explicitly | Prevent false cross-platform claims |
| Never print or commit signing secrets | Release credentials are high-risk |
Do not ship flutter_driver extension in production | It changes runtime behavior and is for automation |
Dart And Flutter MCP Server
The official Dart and Flutter MCP server is experimental. It can expose analyzer, symbol lookup, docs/signatures, pub.dev search, dependency management, tests, formatting, running-app introspection, and app-driving tools to AI assistants.
Use it as acceleration, not as permission to mutate dependencies or run apps without a target plan.
App Driving Guardrail
If enabling flutter_driver, gate it behind a build define:
void main() {
if (const bool.fromEnvironment('ENABLE_FLUTTER_DRIVER')) {
// Enable only in explicit automation runs.
}
runApp(const MyApp());
}
Record the launch flag in the test notes and keep the extension out of production builds.
Done Template
Changed: feature summary
Validated: flutter analyze; flutter test
Target smoke: Android emulator API 35
Release evidence: none
Not tested: iOS, web, desktop
Risk: plugin supports Android/iOS only; web disabled for this feature
Warning: Agents tend to overclaim Flutter readiness from debug-mode success. Require target, mode, artifact, and evidence.