Flutter 3.47

Flutter 3.47

What’s new in Flutter 3.47: Modular by design: Standalone UI Packages and Impeller on Desktop Flutter 3.47 新特性:模块化设计——独立 UI 包与桌面端 Impeller

Flutter 3.47 is here, and with it, we’ve got some exciting new updates. Today, we welcome the 1.0 release of the standalone material_ui and cupertino_ui packages. This is a major milestone that decouples design systems from the core SDK. We’re also boosting performance and tooling across the board. This release brings Impeller to desktop by default, prepares our pipelines for iOS, macOS, and Xcode 27, and graduates Flutter Widget Previews to stable. So, run flutter upgrade in your terminal to get started, or read on to learn more about the major changes in this release. Flutter 3.47 现已发布,带来了一系列令人兴奋的更新。今天,我们迎来了 material_uicupertino_ui 独立包的 1.0 版本。这是一个重要的里程碑,标志着设计系统正式从核心 SDK 中解耦。同时,我们全面提升了性能和工具链。此版本将 Impeller 设为桌面端的默认渲染引擎,为 iOS、macOS 和 Xcode 27 的流水线做好了准备,并将 Flutter Widget Previews 提升至稳定版。请在终端运行 flutter upgrade 开始体验,或继续阅读以了解本次发布的主要变更。

Choose your own UI adventure

选择你的 UI 之旅

The first step toward a decoupled Flutter is here: Material and Cupertino are now available as standalone packages! One of Flutter’s greatest strengths is its ability to render pixel-perfect Material and Cupertino widgets. However, because these design libraries were historically bundled directly inside the core SDK, it slowed down their development and made it harder to contribute or keep them up to date. While the core SDK still includes these libraries for this release, you can now opt-in to the standalone material_ui and cupertino_ui packages, which have officially reached version 1.0 on pub.dev. 迈向解耦 Flutter 的第一步已经到来:Material 和 Cupertino 现在以独立包的形式提供!Flutter 的核心优势之一是能够渲染像素级完美的 Material 和 Cupertino 组件。然而,由于这些设计库过去直接捆绑在核心 SDK 中,这减缓了它们的开发速度,并增加了贡献代码或保持更新的难度。虽然本版本核心 SDK 仍包含这些库,但你现在可以选择使用已在 pub.dev 上正式发布 1.0 版本的独立 material_uicupertino_ui 包。

Decoupling design roadmaps (Opt-in)

解耦设计路线图(可选)

By opting into the decoupled design systems, you gain control over your design roadmap. Because material_ui and cupertino_ui now live on pub.dev, they can ship bug fixes and new components on their own weekly schedules, independent of the quarterly Flutter SDK releases. Decoupling the design systems gives us the following benefits: 通过选择使用解耦的设计系统,你可以掌控自己的设计路线图。由于 material_uicupertino_ui 现在托管在 pub.dev 上,它们可以按照自己的每周计划发布错误修复和新组件,而不受 Flutter SDK 每季度发布周期的限制。解耦设计系统带来了以下好处:

  • You can use the latest Cupertino and Material widget styles without being forced to upgrade your entire Flutter SDK version.
  • 你可以在无需强制升级整个 Flutter SDK 版本的情况下,使用最新的 Cupertino 和 Material 组件样式。
  • We can land contributions and updates faster and more frequently.
  • 我们可以更快、更频繁地合并贡献和更新。
  • We lay the groundwork for a style-neutral Flutter core widget catalog, making it easier to build custom design systems in the future.
  • 我们为样式中立的 Flutter 核心组件目录奠定了基础,使未来构建自定义设计系统变得更加容易。

How to migrate

如何迁移

To migrate your project to the new standalone packages, run the following command: 要将你的项目迁移到新的独立包,请运行以下命令:

dart fix --apply --code=migrate_design_widgets

This tool automatically updates your imports from package:flutter/material.dart and package:flutter/cupertino.dart to the new standalone packages. Note: If the migration tool encounters issues updating your pubspec.yaml (a known early bug), you can resolve it by manually running flutter pub add material_ui (and cupertino_ui if you use it), then running dart fix --apply once more. The original design libraries inside the core SDK are scheduled for formal deprecation in the upcoming Fall stable release in November. If you are migrating a package in the ecosystem, treat this move to the standalone packages as a major release. 该工具会自动将你的导入路径从 package:flutter/material.dartpackage:flutter/cupertino.dart 更新为新的独立包。注意:如果迁移工具在更新 pubspec.yaml 时遇到问题(这是一个已知的早期 Bug),你可以通过手动运行 flutter pub add material_ui(如果使用 cupertino_ui 也需添加),然后再次运行 dart fix --apply 来解决。核心 SDK 中的原始设计库计划在 11 月即将发布的秋季稳定版中正式弃用。如果你正在迁移生态系统中的某个包,请将此次迁移视为一次重大版本更新。

Bridging the migration gap

弥合迁移差距

To facilitate bridging the gap as the ecosystem migrates to the new standalone design libraries, material_ui and cupertino_ui ship with migration utilities. The MaterialUiCompatibilityBridge allows your application to migrate to the standalone packages immediately, even if some of your package dependencies are still using legacy core SDK imports. 为了在生态系统迁移到新的独立设计库时弥合差距,material_uicupertino_ui 提供了迁移工具。MaterialUiCompatibilityBridge 允许你的应用程序立即迁移到独立包,即使你的一些依赖包仍在使用旧版核心 SDK 导入。

Decoupled localizations

解耦本地化

As part of this transition, flutter_localizations has also been unbundled. Localization delegates and translated strings for Material and Cupertino widgets now reside inside package:material_ui and package:cupertino_ui respectively. 作为此次过渡的一部分,flutter_localizations 也已被拆分。Material 和 Cupertino 组件的本地化代理(delegates)和翻译字符串现在分别位于 package:material_uipackage:cupertino_ui 中。

Setting localizationsDelegates to GlobalMaterialLocalizations.delegates now includes the Cupertino and Widgets delegates as well, simplifying your setup. 将 localizationsDelegates 设置为 GlobalMaterialLocalizations.delegates 现在会自动包含 Cupertino 和 Widgets 的代理,从而简化了你的配置。

Open for contribution

开放贡献

By freezing contributions to the Material and Cupertino libraries back in April, we’ve been able to ensure a smooth migration. The libraries waiting for you in material_ui and cupertino_ui are the same libraries you are already using. Now that we are ready to lift the freeze, look forward to more fixes and features rolling out on a regular basis in the new packages, with releases currently planned to land weekly. We are also excited to officially open these packages for community contributions. 通过在四月份冻结对 Material 和 Cupertino 库的贡献,我们确保了迁移过程的顺利进行。material_uicupertino_ui 中的库与你目前使用的库完全相同。现在我们准备解除冻结,期待新包能定期推出更多修复和功能,目前计划每周发布一次。我们也非常高兴正式开放这些包,欢迎社区贡献。

Prepping for the next wave of Apple updates

为下一波 Apple 更新做准备

With Xcode 27, iOS 27, and macOS 27 arriving this fall, we have focused heavily on making sure Flutter is ready for the upcoming updates. To ensure your users don’t experience day-one surprises, we recommend testing your apps against the Apple betas now. Additionally, to support Xcode 27, the minimum supported OS versions have been bumped: 随着 Xcode 27、iOS 27 和 macOS 27 将于今年秋季发布,我们重点确保 Flutter 能够应对这些即将到来的更新。为了确保你的用户不会在发布首日遇到意外,我们建议你现在就开始使用 Apple 测试版进行应用测试。此外,为了支持 Xcode 27,最低支持的操作系统版本已提高:

PlatformPrevious minimumNew minimum (Flutter 3.47+)
平台之前最低版本新最低版本 (Flutter 3.47+)
iOS1315
macOS10.1512

UIScene lifecycle mandate

UIScene 生命周期强制要求

The iOS 27 SDK now mandates the UIScene lifecycle for all UIKit-based apps. Apps built with Xcode 27 that do not adopt UIScene will fail to launch on startup. For most apps, the Flutter CLI handles this migration automatically. iOS 27 SDK 现在强制要求所有基于 UIKit 的应用使用 UIScene 生命周期。使用 Xcode 27 构建且未采用 UIScene 的应用将无法启动。对于大多数应用,Flutter CLI 会自动处理此迁移。