2

Flutter version 2.10 is officially released! While it's been less than two months since the last stable release of , , even in this short period of time, we've processed and closed 1843 issues and merged 1525 PRs from 155 contributors worldwide. Thank you all for your great work during the holiday season in late 2021.

We have several exciting things to announce, including a major update to Flutter's Windows support, several major performance improvements, new support for icons and colors in the framework, some tooling improvements, and more. Additionally, this release includes updates that remove the dev channel, reduced support for older versions of iOS, and several brief breaking changes. let's start!

Support for building Windows desktop apps with Flutter has entered a stable phase

First of all, Flutter 2.10 brings stable Windows support, there is no need to configure Windows desktop app support separately via the --enable-windows-desktop flag, as it is now enabled by default!

Of course, this stable release is definitely more than just "removing" a flag ;-) In Flutter 2.10's Windows support, there are also extensive improvements to text handling, keyboard handling, and keyboard shortcuts, as well as direct New ways to integrate with Windows, support for command line arguments, globalized text input, accessibility features, and more.

For more information about the Windows stable release, you can read another push article today, which details the architecture of Flutter on Windows and how many Flutter packages and plugins already support Windows. You can also check out some samples made with Flutter on Windows by our tool and app partners, and more.

Engine performance improvements

This version of Flutter includes preliminary support for drawing dirty area management by community member knopp , who selective repainting for single dirty areas on iOS/Metal. This change reduced the rasterization time at the 90th and 99th percentiles by an order of magnitude in some benchmarks, and reduced GPU utilization in these benchmarks from over 90% to under 10%.

优化后的 Skia 渲染基准测试数据 1

We hope that in a future release, will bring the benefits of selective repainting to other platforms .

In Flutter 2.8 . And in Flutter 2.10, we have started using it ( DisplayList ) for optimization. For example, a common opaque layer case has now been implemented in a more efficient way . Even in the worst case, the rasterization time per frame dropped to less than a third of what it was before in our benchmarks.

优化后的 Skia 渲染基准测试数据 2

We will continue to expand this optimization to more scenarios in the future as we continue to develop the recording format.

In profile and release mode, Dart code will be compiled AOT. The key to the lightness and efficiency of this code comes from type flow analysis of the entire program, which unlocks many compiler optimizations and aggressive tree-shaking. But since typeflow analysis must cover the entire program, it can be somewhat performance-intensive. The new version brings a faster type flow analysis implementation . On our benchmarks, the overall build time for Flutter apps dropped by about 10%.

优化后的构建时间

As always, performance enhancements, reduced memory usage, and reduced latency are top priorities for the Flutter team. Looking forward to further improvements in future releases.

iOS platform update

In addition to performance improvements, we've also added and enhanced some platform-specific features. luckysmg brings us a new enhancement on iOS - smoother keyboard animation , which is automatically applied in your app.

iOS 键盘过渡动画

In addition to this, we have also improved the stability of the iOS camera plugin by fixing some edge case crashes .

Finally, We add a new feature to reduce memory usage for 64-bit iOS systems: Compressed pointer .

64-bit architectures represent pointers as 4-byte data structures. When you have a large number of objects, the space occupied by the pointer itself will increase the overall memory usage of the application, especially if your application is larger and more complex, and these applications have more GC jitter. However, it is unlikely that an iOS app will have enough objects to occupy most of the 32-bit address space (2 billion objects), let alone the huge 64-bit address space (90 billion objects).

Compressed pointers were introduced in Dart 2.15, and in this release of Flutter we use this feature to reduce memory usage for 64-bit iOS apps. You can check out Dart 2.15 blog post for details.

At the same time, the stable version of Dart 2.16 is also officially released. We will release the updated content of Dart 2.16 at a later time, so stay tuned.

Android Platform Updates

Flutter version 2.10 also includes many improvements for the Android platform. Now by default, when you create a new app, Flutter supports the latest version of Android , which is Android 12 (API level 31) by default. Additionally, in this release, we have 161ff2baac41ac multidex automatic support. If your app supports Android SDK versions lower than 21 and exceeds the 64K dex method limit, just pass the --multidex parameter to the flutter build appbundle or flutter build apk command, and your app will add multidex support.

Finally, after we received feedback from developers about the confusing error messages Gradle was throwing, we adjusted the Flutter command-line tool, which now provides workarounds for common problems . For example, if you add a plugin to your app that requires you to increase the minimum supported Android SDK version, you will now see a "Flutter Fix" suggestion in the error message.

Gradle 错误提示

We will continue to add suggestions for more workarounds for common error messages, and would like to get your feedback on other error messages that will significantly help developers deal with similar issues.

Web Platform Updates

This release also includes some improvements to the web platform. For example, in previous versions, when the mouse was dragged to the edge of a multi-line text box, it would not follow the scroll correctly. In this version, when the selection cursor is dragged out of the text box, the text box will scroll to browse and select the corresponding text content. This behavior applies to both the web platform and the desktop side.

在 Web 平台选中并拖拽 TextField 光标

Flutter 2.10 also includes another significant improvement to the web platform, we've also been looking to reduce the overhead of running Flutter apps to the web platform, in previous versions, every time we wanted to bring native HTML widgets into Flutter When applying, we all need an overlay as part of our platform view support for the web. Each of these overlays supports custom painting, but also represents a certain amount of performance overhead. If you have a lot of native HTML widgets (such as links) in your app, this can cause a huge performance overhead. In this release we've built a new "undrawn platform view" for the web platform that has essentially eliminated this overhead. We've implemented this optimization into Link widget , which means that if you have a lot of links in your Flutter web app, they won't incur additional performance overhead. Over time, we will apply this optimization to other widgets.

Material 3

This release is the beginning of the transition to Material 3, which includes 's ability to generate an entire color from a single seed color.

You can use any color to create a new ColorScheme type:

final lightScheme = ColorScheme.fromSeed(seedColor: Colors.green);
final darkScheme = ColorScheme.fromSeed(seedColor: Colors.green, brightness: Brightness.dark);

The constructor of ThemeData also has a new colorSchemeSeed parameter that can generate the theme's color scheme directly from the colors:

final lightTheme = ThemeData(colorSchemeSeed: Colors.orange, ...); 
final darkTheme = ThemeData(colorSchemeSeed: Colors.orange, brightness: Brightness.dark, ...); 

Additionally, this release includes the parameter ThemeData.useMaterial3 , which switches the widget to the new Material 3 look .

Finally, we added 1028 new Material icons .

1028 个图标的部分预览

You can follow up the access of Material 3 in in this issue , and leave your feedback at any time.

Integration test improvements

In December 2020, we announced a new approach to end-to-end testing using integration_test , check out the Chinese document Introduction to Integration Testing to learn more. This new package replaces flutter_driver as the recommended way to do integration testing, and provides new features such as Firebase Test Lab support and support for web and desktop.

Since then, we've made further improvements to the integration tests, including the integration_test package into the Flutter SDK , making it easier to integrate with your app. We have now written a new migration guide to help you from flutter_driver tests to integration_test .

Existing documentation , examples and codelab has also been updated for integration_test . If you haven't used integration_test on your Flutter app, start now!

DevTools

In this release, we've also made some improvements to Flutter DevTools, including the ease of using DevTools directly from the command line. Now you don't need to use pub global activate to download and run the latest version of devtools, simply use dart devtools to get the latest version that matches the version of Flutter you are using.

We also made some usability updates , including improvements to inspect large lists in the debugger variables pane and support for mapping (thanks Elliott ).

在 DevTools 中查看大型列表和映射

Finally, we're releasing our annual DevTools Survey! Please provide your feedback and help us improve your development experience.

该调查提⽰将在 2 ⽉中旬的某个时间直接显⽰在 DevTools 中,敬请参与并踊跃反馈!

VSCode improvements

The Visual Studio Code extension for Flutter also gets a number of enhancements, including to preview colors in more places in the code and to update the color code color picker .

VSCode 的 Flutter 颜色选择器

Also, if you want to be a tester for a pre-release version of the Dart and Flutter extensions for VSCode, you can switch to the pre-release version in your extension .

使用预发布版本的插件

You can read more about this update in this the flutter-announce mailing list.

Remove the dev version release channel

In Flutter 2.8, we announced that we're working to remove the dev release channel to simplify your choices and reduce R&D overhead. In this release, we've done that, including:

The Dev channel has now been completely removed. Please let us know if we missed some locations that haven't been removed.

End of support for iOS 9.3.6

Due to the reduced and increased maintenance difficulty of target devices in our lab, we are adjusting support for iOS 9.3.6 in and from "supported" to "best effort" . This means that support for iOS 9.3.6 and support for 32-bit iOS devices will only be maintained through coding practices, Ad-Hoc, and community testing.

We expect to drop support for 32-bit iOS devices and iOS versions 9 and 10 in the stable release of Flutter in Q3 2022. This means that apps built on the stable Flutter SDK will no longer run on 32-bit iOS devices, and the minimum iOS version supported by Flutter will be increased to iOS 11.

breaking changes

We've also worked hard to reduce breaking changes with each release and this release, and while we're not quite there yet, we'll keep trying!

If you are still using these APIs, you can read the migration guide on . As always, a big thank you to the community for contributing tests that help us identify these breaking changes.

Summarize

On behalf of all the members of the Google Flutter team, a big thank you to all of you for being a part of the community! With the help of the community, Flutter can become the most popular cross-platform UI tool. While stable support for Windows has only just begun, we're already looking forward to everything we'll be building together!

Thanks


Flutter
350 声望2.5k 粉丝

Flutter 为应用开发带来了革新: 只要一套代码库,即可构建、测试和发布适用于移动、Web、桌面和嵌入式平台的精美应用。Flutter 中文开发者网站 flutter.cn