Flutter 3.22: Whats new and improved?

Flutter, a cross-platform app development framework that enables developers to create apps for Android, iOS, desktops, watches, and much more has seen a new release in the market. With each release, it is making developers want to flutter more.

Flutter 3.22 comes with a lot of new features and bug fixes which makes the process of app development much more efficient and has seen a lot of performance boost as well.

The Flutter team has merged 1595 pull requests from the Flutter community to make this release possible. So, let’s dive in and uncover all the new features and enhancements brought by the Flutter team for this release one by one.

WebAssembly in flutter 3.22

A major highlight of the release of Flutter 3.22 is the introduction of webAssembly(wasm) compilation for Flutter web apps which is now available in the stable channel. It provides significant performance improvements,which are important especially for applications with rich animation and transitions, where maintaining a smooth frame rate is essential.Earlier flutter webapps were compiled to javascript,now they will be combined to wasm directly aiming to mirror the native machine code performance seen in mobile and desktop applications.Inorder to start using Wasm with your Flutter web apps, check out Dart Wasm documentation.

Engine

Engine is the heart of any flutter application which is responsible for rendering UI elements and handling platform interactions. Earlier flutter used to use Skia rendering engine which they later switched to an impeller rendering engine. With the release of flutter 3.22 , It brings major advancements to the impeller rendering engine.Let’s discuss them below.

Impeller Vulkan Backend on Android

In this release Impeller Vulkan Backend on Android feature is complete. Vulkan is a powerful graphics API that offers significant performance improvements By leveraging Vulkan, Flutter apps on Android can now achieve smoother graphics rendering, leading to a more visually appealing and responsive user experience. This is particularly beneficial for applications that rely heavily on animations, complex UI elements, or 3D graphics.

Ongoing Optimizations and Experimental API

The flutter team is continuing to refine optimizations for specific areas like blur effects and complex path rendering, which would improve overall performance and lower consumption for mobile devices.

Additionally, flutter 3.22 introduces a new experimental API for testing with Impeller which accepts the –enable-impeller flag. This API allows developers to write unit tests that target the Impeller engine specifically. This can help ensure consistent rendering behavior across different platforms and devices.

Framework

Flutter 3.22 also comes with new features for the framework apart from the engine improvements which would improve overall developer productivity.Lets see what are those:

Widget state properties

MaterialState has been renamed to WidgetState and has been moved out of the Material library, to make it available to Cupertino.

Dynamic view sizing

There have been many enhancements added to dynamic view sizing to help developers build responsive layouts, ensuring better UI adaptability across various device screens.

Improved form validation

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

Covariants in 2D APIs

With the introduction of Covariants in a flutter, it reduces the need for type casts in 2D graphics APIs simplifying development workflows, and enhancing performance. This feature is mainly important for developing games and complex animations. This would help those who develop games in Flutter which is entirely game-changing.

Flavor-conditional asset bundling

Developers using the flavors feature can now configure individual assets to be bundled only when building for a specific flavor. This functionality allows developers to specify which assets are included in the final app bundle based on the build flavor (e.g., dev, prod, staging).

Transformation of assets using Dart packages

Users can now configure Dart packages to transform their app’s assets as they are bundled, which means it allows you to manipulate assets during the build process.

Android

The new release also comes with Android-specific features. Let’s discuss what are those:

Deep linking

Deep links 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 this Flutter release, a new set of features has been released in dev tools to help verify setups within your Android manifest files. This tool specifically supports checking web configuration for Android apps, helping you identify and troubleshoot any errors in your deep link setup. This can significantly streamline the process of ensuring seamless deep-linking experiences within your Flutter app on Android.

Predictive back gesture

Flutter 3.22 introduces 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. By integrating this functionality, you can enhance the user experience on Android devices by providing a more responsive and intuitive back navigation experience. This is still behind a feature flag on Android devices.

Enforces version requirements on Gradle, AGP, Java, and Kotlin

In this release, the Flutter tool enforces a policy regarding supported versions for Gradle, the Android Gradle Plugin (AGP), Java, and Kotlin. Initially, this enforcement is limited to warnings.

Currently, the supported version ranges are as follows:

  • Gradle: Fully supported from 7.0.2 to the current version; warnings for other versions.
  • AGP: Fully supported from 7.0.0 to the current version; warnings for other versions.
  • Java: Fully supported from Java 11 to the current version; warnings for other versions.
  • Kotlin: Fully supported from 1.5.0 to the current version; warnings for other versions.

In the next major release, these warnings will escalate to errors. However, you can override this with the flag --android-skip-build-dependency-validation. Generally, the tool provides a warning for at least one release before fully dropping support (resulting in an error) for a given version of these dependencies.

Gradle Kotlin DSL Support

Gradle Kotlin DSL is now supported in Flutter, 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 your flutter apps use native Android components like maps, web views, or certain UI elements, there’s important news: a bug in Android 14 affects apps built with older Flutter versions, potentially causing issues on devices running this new Android version. Flutter 3.22 resolves this problem and enhances the performance of these native components. To ensure smooth operation across all Android devices, rebuild and release your app with Flutter 3.22. This update also includes behind-the-scenes improvements for more reliable and performant platform views on Android.

End of support for KitKat

Flutter’s minimum supported Android version is now Lollipop (API 21). Starting with the Flutter 3.22 stable release, Flutter will no longer support devices running Android KitKat (API 19).

iOS

Platform view performance

Platform views allow you to embed native iOS UI elements within your Flutter app, but performance has been a concern, especially in scrolling views like list views. Flutter 3.22 addresses these issues with significant advancements in platform view performance on iOS. Key improvements include:

  • Reduced GPU Usage: GPU usage when using platform views is reduced by 50%, leading to lower power consumption and smoother scrolling experiences.
  • Improved Frame Rendering: Frame rendering times have improved by an average of 1.66 milliseconds (33%), resulting in a more responsive and fluid user experience, particularly with complex layouts involving platform views.

These optimizations directly address common issues for Flutter developers on iOS, allowing for more performant and visually appealing apps that seamlessly integrate native iOS UI elements.

Ecosystem

Vertex AI for Firebase Dart SDK preview release

This exciting preview release brings the power of Vertex AI, Google’s machine learning platform, directly to your Flutter apps. With the Vertex AI for Firebase Dart SDK, you can leverage both pre-trained and custom models hosted on Vertex AI to add intelligent features to your apps. This enables various use cases, such as image recognition, text classification, and sentiment analysis, all seamlessly integrated within your Flutter codebase.

DevTools updates

Flutter DevTools, the suite of debugging and profiling tools for Flutter developers, has been updated in this release. While the full details will be available in the official release notes, you can expect enhancements to existing functionalities and possibly new features to streamline your development workflow.

Google Mobile Ads SDK for Flutter

Google Mobile Ads for Flutter has released a major update to version 5.0.1, featuring enhanced support for the User Messaging Platform (UMP) SDK, integrating the latest APIs from Android UMP SDK 2.2.0 and iOS UMP SDK 2.4.0. This update simplifies the consent gathering process for personalized ads, ensuring compliance with privacy regulations. Additionally, the update expands mediation options by integrating popular ad partners like Unity, Meta, AppLovin, Iron Source, Mintegral, Pangle, DT Exchange, InMobi, and Liftoff, allowing for maximized app revenue and easier implementation.

Breaking Changes and Deprecations

ColorScheme.fromSeed

ColorScheme.fromSeed constructor has been deprecated in favor of a new API for creating color schemes. The recommended approach now involves using named constructors provided by the ColorScheme class.

Removal of v1 Android embedding

Version 1 of the Android embedding has been removed entirely in Flutter 3.22. Version 2 has been the default for many releases now, and the Flutter tooling already prevented building v1 apps unless specifically overridden.

Deprecations removed in 3.22

This release introduces breaking changes, including deprecated APIs that expired after version 3.19. For a complete list of affected APIs, additional context, and migration guidance, refer to the deprecation guide for this release. Many changes are supported by Flutter fix, with quick fixes available in the IDE. Bulk fixes can be evaluated and applied using the dart fix command-line tool.

Conclusion

Flutter 3.22 represents a significant leap forward for the framework, offering a spectrum of performance enhancements, novel features, and ecosystem refinements. From the stable rollout of WebAssembly support to advancements in the Impeller engine and platform-specific optimizations, this release equips developers with tools to craft more efficient and visually captivating cross-platform applications. Prior to upgrading, it’s advisable to review any breaking changes and deprecations for a seamless transition. We encourage you to delve into the new features of Flutter 3.22 and harness its capabilities to elevate your Flutter development proficiency. Anticipate forthcoming releases that promise further exciting advancements in the realm of Flutter!

Wanna Level up Your Flutter game? Then check out our ebook The Complete Guide to Flutter Developement where we teach you how to build production grade cross platform apps from scratch.Do check it out to completely Master Flutter framework from basic to advanced level.

Leave a comment