Explore the Flutter New Update: Key Features in Flutter 3.22

360
0
Flutter New Update

 

Welcome to another exciting Flutter release! This time, we’re thrilled to present the Flutter new update, Flutter 3.22. This release brings WebAssembly to the stable channel, a fully-featured Vulkan backend for Impeller on Android, promising smoother graphics and a major performance boost. We’re also introducing streamlined workflows with new widget state properties, dynamic view sizing, and improved form validation. But that’s not all — you’ll find flavor-conditional asset bundling, a preview of Vertex AI for Firebase in Dart, and updated DevTools to make your development process easier.

In just a few months since our last update, we’ve merged an impressive 1,595 pull requests from the Flutter community, with 37 new community members contributing to Flutter for the first time!

So, dive in and explore all the new features and enhancements that the Flutter new update has brought to this latest release!

WebAssembly

With the Flutter new update, Wasm is now available on the stable channel, offering significant performance improvements. In our internal benchmarks using Chrome on an M1 MacBook, the Wonderous app’s frame rendering time improved by 2x on average and 3x in worst-case scenarios.

These enhancements are vital for apps with animations and rich transitions, where maintaining a smooth frame rate is essential. Wasm helps achieve this by reducing performance bottlenecks, resulting in smoother animations and transitions. To start using Wasm with your Flutter web apps, check out our Dart Wasm documentation and Flutter Wasm documentation. For the full announcement, visit the Flutter at Google I/O blog post.

Engine

Flutter 3.22 introduces significant updates to Impeller, the rendering engine that powers your Flutter applications. Key highlights include the completion of the Vulkan backend on Android for smoother graphics and improved performance, ongoing optimizations for blur effects and complex path rendering, and a new experimental API for testing with Impeller. This Flutter new update enhances Impeller’s quality and performance, including completing the iOS migration to Impeller and expanding Android support.

Impeller

Vulkan Backend Feature Complete on Android

The Vulkan backend for Android is now feature complete in the Flutter new update. The team has been hard at work completing the implementation of fast advanced blends, support for custom fragment shaders with the FragmentProgram API, PlatformView support, and fully implementing all blur styles.

Android Preview

In the 3.19 stable release, after improvements in Impeller’s OpenGL backend, we invited users to try out Impeller on Android devices both with and without Vulkan support. Evaluating the performance of the OpenGL backend and the remaining work on the Vulkan backend, we decided to focus on making the Vulkan backend production-ready first.

Impeller solves the issue of shader compilation jank. In our benchmarks, it outperforms the legacy renderer on average, 90th, and 99th percentile frame times. We believe that the performance of the Vulkan backend on Android is acceptable. With the Flutter new update, an app that opts-in to Impeller will use the Vulkan backend where available. In a future release, this will become the default. When an app that opts-in to Impeller runs on a device that doesn’t support Vulkan, Flutter will gracefully fall back to using OpenGL ES with Skia. No action is necessary on your part. When the OpenGL ES Impeller backend is production ready, this fallback will also use Impeller.

As the Impeller preview on Android continues through the 3.22 stable cycle, we request that Flutter developers upgrade to the latest stable version and report any issues noticed when Impeller is enabled. Feedback at this stage is invaluable to ensuring that Impeller is successful on Android and that we can confidently make it the default renderer in a release later this year. The Android hardware ecosystem is very diverse, so detailed feedback about the specific device and Android version where issues occurred is most helpful.

Blur Performance Improvements

Blur has been reimplemented in Impeller for both iOS and Android in the Flutter new update. The new approach reduces the CPU and GPU time of blurs by nearly half in benchmarks.

The chart below shows worst-case, 99%-ile, 90%-ile, and average frame rasterization times and GPU frame times in ms on an iPhone 11 device in a pathological benchmark intended to highlight blur performance. After rewriting Impeller’s blur, both the CPU and GPU cost of backdrop filter blurs has been nearly halved. This scale of improvement translates to non-pathological cases as well.

Stencil-then-Cover

Impeller on both iOS and Android has moved to a new rendering strategy based on the Stencil-then-Cover approach. This technique reduces the time spent calculating tessellations for complex paths on the CPU, such as SVGs and Lottie animations. After the change, the total frame time (UI thread on the CPU + raster thread on the CPU + GPU work) is much lower for frames that contain complex paths. Users will notice that Lottie animations and other complex paths render more smoothly, with lower CPU utilization, and slightly higher GPU utilization.

New API

While still experimental, flutter test now accepts the --enable-impeller flag, which exercises Impeller using the Vulkan backend.

Framework

Widget State Properties

MaterialState has been moved outside of the Material library and renamed WidgetState in the Flutter new update, making it available to Cupertino, the base Flutter framework, and package authors. For more information on migrating to the new WidgetState, see the migration guide.

Dynamic View Sizing

Enhancements to dynamic view sizing in the Flutter new update benefit developers building responsive layouts, ensuring better UI adaptability across various device screens.

Improved Form Validation

Flutter 3.22 includes more flexible form validation methods, allowing developers to create more robust user input handling, enhancing both usability and security.

Covariants in 2D APIs

Reducing the need for type casts in 2D graphics APIs simplifies development workflows and enhances performance, important for games and complex animations.

Flavor-Conditional Asset Bundling

Developers using the flavors feature can now configure individual assets to be bundled only when building for a specific flavor. For more information, check out Conditionally bundling assets based on flavor.

Transformation of Assets Using Dart Packages

Users can now configure Dart packages to transform their app’s assets as they are bundled. For more information, check out Transforming assets at build time.

Android

Deep Linking

Deep links can significantly improve the user experience in your Flutter app, acting as shortcuts that seamlessly guide users to specific content within your app, boosting engagement, and driving sales. In the last Flutter stable release, we introduced a deep link validator tool within DevTools that supports checking web configuration for Android apps. In this version, we added a new set of features to help verify setups within your Android manifest files. For more information on using this tool, check out Validate deep links.

Predictive Back Gesture

Flutter now adds more support for Android’s upcoming predictive back feature, where users can peek at the previous route or even the previous app during a back gesture. This is still behind a feature flag on Android devices, but you can find details on how to try it out yourself on GitHub.

Flutter Tool Enforces Version Requirements on Gradle, AGP, Java, and Kotlin

In this release, the Flutter tool enforces a policy regarding the versions it supports for Gradle, the Android Gradle Plugin (AGP), Java, and Kotlin. Initially, the tool only provides warnings.

Currently, the supported version ranges are as follows:

  • Gradle — Fully supported 7.0.2 to current, warn otherwise
  • AGP — Fully supported 7.0.0 to current, warn otherwise
  • Java — Fully supported Java 11 to current, warn otherwise
  • Kotlin — Fully supported 1.5.0 to current, warn otherwise

In the next major release, these warnings will become errors, which can be overridden with the flag --android-skip-build-dependency-validation. This policy was discussed in an associated design spec. Comments and feedback are always welcome.

Support for Using Gradle Kotlin DSL in Gradle Build Scripts on Android

Gradle Kotlin DSL is now supported in the Flutter new update, providing an alternative to the traditional Gradle Groovy DSL. This support allows for a better code editing experience, featuring auto-completion, quick access to documentation, source navigation, and context-aware refactoring.

Platform Views Improvements

If you’re using Flutter to build apps that rely on native Android components (like maps, web views, or certain UI elements), the Flutter new update includes important news. Due to a bug in Android 14, apps built with older versions of Flutter might not work properly on devices running this new Android version.

Flutter 3.22 fixes this issue and improves the overall performance of these native components in your Android apps. So, to ensure your app runs smoothly on all Android devices, make sure to rebuild and release your app with the Flutter new update.

This update also includes behind-the-scenes improvements to make platform views on Android more reliable and performant overall.

End of Support for KitKat

Flutter’s minimum supported Android version is now Lollipop (API 21). Beginning with Flutter’s 3.22 stable release, Flutter will no longer work on devices running Android KitKat (API 19). For more details, see our deprecation guide.

iOS

Platform View Performance

We understand that platform view performance on iOS has been a pain point for many Flutter developers. This has been especially noticeable within scroll views when using platform views.

Recent updates directly address these concerns, with significant improvements in scenarios like embedding multiple inline ads within an article. Here are some key improvements in our benchmark:

  • Reduced GPU usage: GPU usage has been reduced by 50%, leading to less power consumption and a potentially smoother user experience.
  • Improved frame rendering: Average frame render times have decreased by 1.66ms (33%).
  • Minimized jank: Worst-case frame render times have been reduced by 3.8ms (21%).

If you’ve previously experienced performance challenges when using multiple platform views (like ads, maps, etc.) within scrolling views, these optimizations offer the potential for a more fluid and responsive scrolling experience. Please give it a try and let us know what you think.

Flutter New Update

 

Flutter New Update

Ecosystem

Vertex AI for Firebase Dart SDK Preview Release

The Vertex AI for Firebase product has been released to public preview and includes the Dart SDK. This enables you to use the Gemini API to build generative AI features for your Dart or Flutter app, with production, performance, and enterprise scale in mind. The SDK is integrated with Firebase App Check, which protects your API calls, and safeguards your backend infrastructure from serious threats like billing fraud, phishing, and app impersonation. Jump into the Getting Started for Dart and start using it with no cost with a promo code.

The Google AI Dart SDK remains available and is recommended for prototyping only. Google AI has free-of-charge access (within limits and where available) and pay-as-you-go pricing. If you have been prototyping with the Google AI Dart SDK and are ready to migrate to Vertex AI for Firebase, check out the migration guide.

DevTools Updates in Flutter new update

We continue to improve DevTools, the suite of performance and debugging tools for Dart and Flutter. This release includes performance improvements, general polish, and new features like including CPU samples in the timeline, advanced filtering, and support for importing and exporting memory snapshots.

Other notable improvements were shipped with the devtools_extensions and devtools_app_shared packages that support DevTools extension authors. We added support for connecting an extension to the new Dart Tooling Daemon (DTD), which allows DevTools extensions to access public methods registered by other DTD clients, such as an IDE, as well as allowing access to a minimal file system API for interacting with the development project.

To learn more about all the updates included in Flutter 3.22, check out the release notes for DevTools 2.32.0, 2.33.0, and 2.34.1.

Google Mobile Ads SDK for Flutter

For those of you monetizing your Flutter apps with Ads, we’ve got some exciting news: Google Mobile Ads for Flutter has just released a major update to version 5.0.1!

Enhanced support for User Messaging Platform (UMP) SDK: The update adds support for the latest APIs from the Android UMP SDK version 2.2.0 and iOS UMP SDK version 2.4.0. The UMP SDK is crucial for complying with privacy regulations, making it easier for you to obtain user consent for personalized ads. This new version introduces several new APIs to simplify the consent gathering process.

Expanded mediation partners: We’ve broadened your ad monetization horizons by offering integrations with popular ad partners, including Unity, Meta, AppLovin, Iron Source, Mintegral, Pangle, DT Exchange, InMobi, and Liftoff. You can now maximize your app revenue with expanded mediation options and simplified implementation.

We encourage you to try out these new features in your Flutter apps and let us know which other mediation partners you’d like to see us support. Your feedback is invaluable as we continue to enhance the Google Mobile Ads SDK for Flutter.

Breaking Changes and Deprecations

Removal of V1 Android Embedding

Deletion of version one of the Android embedding is underway in the Flutter new update. This will likely have no effect on most apps, as:

  • Version two has been the default for many years
  • The Flutter tool would already block building version one apps, unless specifically overridden with the flag –ignore-deprecation.

This release breaks Flutter tool support for v1 apps completely. It is no longer possible to override.

Plugin authors, please note: when the v1 android embedding was initially deprecated a migration doc was written for plugin authors at Flutter Documentation. As part of this migration, it was recommended that plugin authors keep support for apps using the v1 embedding by including in their *Plugin.java a method with the signature:

java

public static void registerWith(@NonNull io.flutter.plugin.common.PluginRegistry.Registrar registrar)

We plan to fully delete the v1 Android embedding in the next release, at which point plugins that include a method with this signature will no longer compile (as it makes reference to a type from the v1 Android embedding).

It currently serves no purpose, as this release has broken apps using the v1 embedding. We recommend that plugin authors release updated versions of their plugins with the v1 code removed as soon as possible, to avoid breakage in future versions of Flutter. For an example, check out PR 6494, which removed the plugins maintained by the Flutter team.

Deprecations Removed in 3.22

Breaking changes in the Flutter new update include deprecated APIs that expired after the release of v3.19. To see all affected APIs, along with additional context and migration guidance, see the deprecation guide for this release. Many of these are supported by Flutter fix, including quick fixes in the IDE. Bulk fixes can be evaluated and applied with the dart fix command-line tool.

Flutter New Update FAQ: Key Features in Flutter 3.22

1. What are the key highlights of the Flutter new update?

The Flutter new update, Flutter 3.22, introduces several exciting features and improvements, including:

  • WebAssembly support for better performance on web apps.
  • A fully-featured Vulkan backend for Impeller on Android, enhancing graphics and performance.
  • New widget state properties, dynamic view sizing, and improved form validation.
  • Flavor-conditional asset bundling and Vertex AI for Firebase in Dart.
  • Updated DevTools for an improved development experience.

2. How does the Flutter new update improve performance?

The Flutter new update enhances performance through several key features:

  • WebAssembly (Wasm) support significantly improves performance, especially for apps with rich animations and transitions.
  • The Vulkan backend for Impeller on Android offers smoother graphics and reduces shader compilation jank.
  • Improved blur performance and the new Stencil-then-Cover rendering strategy reduce CPU and GPU load, resulting in smoother animations and transitions.

3. What is the WebAssembly support in Flutter 3.22?

The Flutter new update introduces WebAssembly (Wasm) support, allowing Dart code to be compiled to Wasm. This enhances the performance of Flutter web applications by reducing frame rendering times and providing smoother animations.

4. How does the Vulkan backend improve graphics on Android?

The Vulkan backend, now feature-complete in the Flutter new update, offers advanced graphics capabilities and better performance compared to the legacy renderer. It reduces shader compilation jank and supports fast advanced blends, custom fragment shaders, and fully implemented blur styles.

5. What are the new widget state properties in Flutter 3.22?

In the Flutter new update, MaterialState has been moved outside of the Material library and renamed WidgetState. This change makes WidgetState available to Cupertino, the base Flutter framework, and package authors, enabling more flexible state management across different types of widgets.

6. How does dynamic view sizing work in Flutter 3.22?

The Flutter new update includes enhancements to dynamic view sizing, benefiting developers building responsive layouts. This feature ensures better UI adaptability across various device screens, making it easier to create layouts that look great on all devices.

7. What improvements have been made to form validation in Flutter 3.22?

Thanks to contributions from the Flutter community, the Flutter new update includes more flexible form validation methods. These improvements allow developers to create more robust user input handling, enhancing both usability and security.

8. What is flavor-conditional asset bundling?

The Flutter new update introduces flavor-conditional asset bundling, allowing developers to configure individual assets to be bundled only when building for a specific flavor. This feature helps manage assets more efficiently, especially in apps with multiple build flavors.

9. How has the Google Mobile Ads SDK for Flutter improved in this update?

The Flutter new update includes a major update to Google Mobile Ads for Flutter, version 5.0.1. Enhancements include:

  • Support for the latest User Messaging Platform (UMP) SDKs for both Android and iOS.
  • Expanded mediation options with popular ad partners like Unity, Meta, AppLovin, and more.

10. What are the breaking changes in the Flutter new update?

The Flutter new update includes several breaking changes, such as the removal of v1 Android embedding support and the deprecation of certain APIs. Plugin authors and developers are advised to update their code to comply with the new requirements to avoid build issues.

11. How can I start using the Flutter new update?

To start using the Flutter new update, Flutter 3.22, simply run flutter upgrade in your terminal. This command will update your Flutter SDK to the latest version, allowing you to take advantage of all the new features and improvements.

12. Where can I find more information about the Flutter new update?

For detailed information about the Flutter new update, including all the new features, improvements, and breaking changes, check out the full release notes and changelog. You can also visit the Flutter blog for announcements and additional insights.

Conclusion

At the heart of Flutter’s success is you — our amazing community. This release wouldn’t be possible without your countless contributions and unwavering passion. From the bottom of our hearts, thank you.

Ready to explore the Flutter new update? Dive into the full release notes and changelog, fire up your terminal, and run flutter upgrade. We can’t wait to see what you build!

Leave a Reply

Your email address will not be published. Required fields are marked *