最近不管是 Shopify 或者这两个月的舆论,貌似都在说:既然 AI 已经能低成本出 Swift 和 Kotlin 的原生代码,那企业为什么还要用 Flutter?直接让两个 Agent 分别维护 iOS 和 Android 不就好了?
对于这个,Flutter 官方的回答是:持续维护成本。
大家理解的 AI 降低成本,实际上降低的是第一次把代码写出来的成本,但 App 上线几年的持续维护成本,比如让不同平台一直能保持相同的行为,一个 Bug 在多个代码仓库能都正常修复,这些都是成本。
简单来说官方的角度是:
- 一套代码库积累的不只是代码,还有大量产品决策和故障修复的历史,AI 同时维护两套原生实现,但是可能把一个需求理解成两种行为落地都不同仓库里。
- 写代码确实不慢,但是 AI 时代验收成本才是问题和瓶颈,比如 Flutter 把热重载、Widget 测试、Analyzer 和运行时 Widget Inspector 接到 Agent 工具链,就是在试图缩短「修改—运行—检查」这样的循环
- Flutter 目前已经把 Agent 的工作流程当成工程基础设施维护,包括 MCP、Skills、包作者提供的规则,还有真实插件里的测试门禁,也就是 Flutter 已经转型成面相 AI 的开发框架,这些其实我们之前都聊过了
其实这几个还挺好理解的,比如第一个,两套原生代码 AI 当然可以写,但行为偏差还是会在过程累积,一个结账状态机的例子:
- iOS Agent 用异步流处理网络回包,发现旧请求过期就丢弃
- Android Agent 用 Flow 实现时,但是反而把旧事件排队继续处理
这两边代码其实都合理,本地单元测试也可能通过,但是当用户在网络不稳定时触发重试,就有可能出现一端忽略旧结果,另一端又把旧结果写回状态的情况。
也就是,AI 可以降低 Swift 和 Kotlin 的生产成本,但不是零成本就可以消除两套实现之间的需求理解、重试时序和边界行为差异, 比如需求以后每改一次,两端还是需要各自实现和对照验证。
这就是 Flutter 还存在的意义,特别是中小团队,Flutter 用一套 Dart 业务逻辑和状态机,至少可以让这部分行为只定义一次,UI 完整性也只需要验收一次,再共享到 iOS、Android 甚至鸿蒙等平台。
当然,最重要还是,是 Flutter 开始给 Agent 建立验证闭环,比如 Flutter Stateful Hot Reload 可以走到低于 200 毫秒、Widget 测试低于 500 毫秒,对比传统原生构建需要 2~5 分钟,所以实际上 Agent 可以做到每修改一次代码,能直接看到确定性反馈,可以在相同时间里尝试和修正更多问题。
不过涉及原生插件这部分不可能也这么快,但是这部分才是 AI 时代最有价值的地方,以前你写 Flutter 最怕就是原生插件,没人适配,你自己又不懂,写起来就很烧心。
但是现在 AI 时代后,插件有问题直接改,这反而是一种优势。
目前官方维护了 Flutter Agent Plugins 和 Dart Skills,分别有 10 个 Flutter Skills 和 14 个 Dart Skills,配合 dart mcp-server 就能把静态分析、测试执行和运行时检查接进 Codex、Claude Code、Cursor 之类的开发工具。
甚至现在包作者可以直接把对应 Skill 跟着 pub.dev 依赖发布,开发者运行 dart run skills@ get 就能发现当前依赖提供的规则。
其他的 A2UI 和 GenUI SDK for Flutter ,还是有 GenKit Agent SDK 什么的,这些都是 Flutter 围绕 AI 的适配和基建能力。
所以 Flutter 不只是跨平台框架,在 AI 时代它也进一步围绕 AI 在进化,这也是 Flutter 在 AI 时代的意义。
链接
flutter.dev/blog/ai-mak…
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
Recently, whether it be Shopify or two months of public opinion, it seems to be saying, "If AI has been able to come up with the original code of Swift and Kotlin, why use Flutter?" Why don't you just let two Agents maintain iOS and Android?
For this, the official answer of Flutter is: the cost of continuous maintenance.
It's understood that AI lowers the cost, actually lowers the cost of writing code for the first time, but the continued maintenance costs of App go online for several years, for example, to keep different platforms in the same position, and a bug can be properly repaired in multiple code warehouses.
In short, the official angle is:
- A collection of codes accumulates not only codes, but also a history of extensive product decision-making and failure repair, while AI maintains both sets of originals, but may understand a need to be located in a warehouse where both behaviours are different.
- It's not slow to write codes, but the AI-era acceptance check cost is a problem and a bottleneck, like Flutter's trying to shorten the cycle of "modify-run-check" by taking heat load, Widget testing, Analyzer and Widget Inspector to the Agent tool chain while running.
- Flutter has now used Agent's workflow program as an engineering infrastructure maintenance, including MCP, Skills, the rules provided by the author of the package, and the test doors in the real plugin, that is, the Flutter has been transformed into an AI development framework, which we have talked about before.
Actually, they're quite understandable, like the first, two sets of original codes. AI, of course, can write, but behavioral deviations accumulate in process, an example of a billing machine:
- iOS Agent returned the package with a walk-through, and the old request expired and was discarded.
- Android Agent used the Flow to do it, but instead line up the old events.
Both codes are valid and local unit tests may pass, but when the user triggers retry when the network is unstable, there is a risk that one end will ignore the old results and the other will write back the old results.
That is, AI can reduce the production costs of Swift and Kotlin, but not zero costs can eliminate the differences between the two sets of realizations in terms of demand understanding, retry time lines and boundary behaviour, for example, each change in demand after which the two ends need to be achieved and compared.
That's the point of Flutter, especially the small and medium team, which uses a Dart business logic and status machine to define this part of the behavior at least once, and the UI integrity only needs acceptance check once to share it with iOS, Android and even Hongmong.
The most important thing, of course, is that Flutter started to create a authentication loop for Agent, for example, where Flutter Stateful Hot Reload can reach less than 200 milliseconds, and Widget tests less than 500 milliseconds, which takes two to five minutes to compare traditional original construction, so in fact Agent can do every change in the code, see certainty feedback directly, and try and correct more problems at the same time.
But this part of the primary plug is not going to be so fast, but it's the most valuable part of the AI era, and you used to write Flutter, and you were afraid that it was the original plug, and nobody was fit, and you didn't understand it, and it was very heartbreaking.
But now, after the AI era, there's a problem with a direct change in the plugin, which is an advantage.
The official maintenance of Flutter Agent Plugins and Dart Skills, 10 Flutt Skills and 14 Dart Skills, respectively, together with the dart mcp-server, allows static analysis, test execution and running-time checks to feed into development tools such as Codex, Claude Code and Cursor.
Even now the package author can directly follow the Skill with the pub.dev relying on publish, and the developers run the dar run skills@ get to find the current rules that depend on the supply.
The other A2UI and GenUI SDK for Flutter, or GenKit Agent SDK or something, are flexing and building capacity around AI.
So Flutter is not just a cross-platform framework, but it's more about AI in the AI era, and that's what Flutter means in the AI era.
Link
flutter.dev/blog/ai-mak…
Auto-fetched and translated by AI Atlas. All rights belong to the original author.