Flutter
Published in

Flutter

What’s new in Flutter 2.5

Performance improvements, DevTools updates, new Material You support, a new app template, and more!

Performance: iOS shader warmup, async tasks, GC & message passing

This release comes with several performance improvements. First on this list is a PR to wire up Metal shader precompilation from offline training runs (#25644), which (as our benchmarks show) cuts worst case frame rasterization times by 2/3s, and the 99th percentile frame by half. We continue to make progress on reducing iOS jank and this is another step along that path. Shader warmup is but one source of jank, however. Previously, processing asynchronous events from the network, filesystem, plugins, or other isolates could interrupt animations, another source of jank. Following improvements to scheduling policies (#25789) on the UI isolate’s event loop in this release, frame processing now takes priority over processing other asynchronous events, eliminating jank from this source in our testing.

Frame lag due to processing asynchronous event results before and after
GCs before and after adding the fix to eagerly reclaim unused large image memory
iOS message latencies before and after

Dart 2.14: formatting, language features, pub & linting out-of-the-box

Of course, Flutter isn’t Flutter without the Dart language and runtime on which it builds. This release of Flutter comes with Dart 2.14. The new release of Dart comes with new formatting to make cascades more clear, new pub support for ignoring files, and new language features, including the return of the legendary triple shift operator. In addition, and one of the best things about Dart 2.14, is that this release has created a standard set of lints shared between new Dart and Flutter projects that come right out of the box.

`flutter create` comes out of the box with an analysis_options.yaml file pre-populated with recommended Flutter lints

Framework: Android full screen, Material You & text editing shortcuts

The Flutter 2.5 release includes a number of fixes and improvements to the framework. Starting with Android, we’ve fixed a set of related issues around full screen modes with nearly 100 thumbs up between them. The names of the modes themselves makes this one of our favorite new features: lean back, sticky, sticky immersive, and edge to edge. This change also added a way to listen to fullscreen changes in the other modes. For example, if the user engages with the app, when the system UI comes back, developers can now write their code to return to fullscreen or do something else.

New Android edge-to-edge mode: normal mode (left), Edge to Edge mode (center), Edge to Edge with a custom SystemUIOverlayStyle (right)
New Material You FAB sizes
New MaterialState.scrolledUnder state in action
The new scroll metrics notifications enabling the scrollbar to appear and disappear automatically without scrolling

Plugins: camera, image picker & plus plugins

Another plugin that’s seen a lot of improvements is the camera plugin:

  • 3795 [camera] android-rework part 1: Base classes to support Android Camera features
  • 3796 [camera] android-rework part 2: Android auto focus feature
  • 3797 [camera] android-rework part 3: Android exposure related features
  • 3798 [camera] android-rework part 4: Android flash and zoom features
  • 3799 [camera] android-rework part 5: Android FPS range, resolution and sensor orientation features
  • 4039 [camera] android-rework part 6: Android exposure- and focus point features
  • 4052 [camera] android-rework part 7: Android noise reduction feature
  • 4054 [camera] android-rework part 8: Supporting modules for final implementation
  • 4010 [camera] Do not trigger flat device orientation on iOS
  • 4158 [camera] Fix coordinate rotation for setting focus- and exposure points on iOS
  • 4197 [camera] Fix camera preview not always rebuilding on orientation change
  • 3992 [camera] Prevent crash when setting unsupported FocusMode
  • 4151 [camera] Introduce camera_web package
  • 3898 [image_picker] Image picker fix camera device
  • 3956 [image_picker] Change storage location for camera captures to internal cache on Android, to comply with new Google Play storage requirements
  • 4001 [image_picker] Removed redundant request for camera permission
  • 4019 [image_picker] Fix rotation when camera is a source

Flutter DevTools: performance, Widget inspector, & polish

This release of Flutter comes with a number of improvements to Flutter DevTools. First and foremost is the added support in DevTools to take advantage of engine updates (#26205, #26233, #26237, #26970, #27074, #26617). One set of these updates enables Flutter to do a better job of associating trace events with specific frames, which helps developers to determine why a frame might be going over budget. You can see this reflected in the DevTools Frames chart that has been rebuilt to be “live”; frames are populated in this chart as they are rendered in your app. Selecting a frame from this chart navigates to the timeline events for that frame:

DevTools detecting lost frames due to shader compilation
Colored frame chart to identify app vs. native vs. Dart vs. Flutter code activities in your app
Flutter DevTools polished UX for greater ease of use
  • Better communicating what the debug toggle buttons do — those buttons have new icons, task-oriented labels, as well as rich tooltips that describe what they do and when to use them. Each tooltip further links out to detailed documentation of the feature.
  • Easier to scan and locate widgets of interest — frequently used widgets from the Flutter framework now show icons in the widget tree view on the left hand side of the inspector. They’re further color coded based on their categories. For example, layout widgets are displayed in blue while content widgets are displayed in green. Furthermore, each Text widget now shows a preview of its content.
  • Aligning the color scheme of the layout explorer and the widget tree — it’s now easier to identify the same widget from the layout explorer and the widget tree. For example, the “Column” widget in the screenshot below is on a blue background in the layout explorer, and it has a blue icon in the widget tree view.

IntelliJ/Android Studio: integration tests, test coverage, and icon previews

The IntelliJ/Android Studio plugin for Flutter has also undergone a number of improvements with this release, starting with the ability to run integration tests (#5459). Integration tests are whole-app tests that run on a device, live in the integration_test directory and use the same testWidgets() functionality from widget unit tests.

Integration testing your Flutter app in IntelliJ/Android Studio
Icon preview in IntelliJ/Android Studio

Visual Studio Code: dependencies, Fix All, and Test Runner

The Visual Studio Code plugin for Flutter has also improved in this release, beginning with two new commands “Dart: Add Dependency” and “Dart: Add Dev Dependency” (#3306, #3474).

Adding a Dart dependency in Visual Studio Code
Using Flutter Fix rules to fix all known issues in your code
Using the new Visual Studio Code test runner test your Dart and Flutter code
  • v3.26 VS Code Test Runner integration, Flutter Create Settings, …
  • v3.25 Additional Dependency Management improvements, Fix All in File / On-Save, …
  • v3.24 Dependencies tree improvements, Easier launch configurations, Editor improvements
  • v3.23 Profile Mode improvements, Improved dependencies tree, LSP improvements

Tools: exceptions, new app template & Pigeon 1.0

In previous versions of Flutter, you may have been frustrated by exceptions that you expected to be unhandled so that you could trigger the debugger and figure out where they originated only to find that the Flutter framework did not let the exception through to trigger the “unhandled expectation” handler in your debugger. In this release, debuggers now break correctly on unhandled exceptions that previously were just caught by the framework (#17007). This improves the debugging experience as your debugger can now point you directly to the throwing line in their code instead of pointing to a random line deep in the framework. A related new feature enables you to decide if a FutureBuilder should rethrow or swallow errors (#84308). This should give you a large number of additional exceptions to help track down the issues in your Flutter apps.

The new Flutter skeleton template in action
  • Uses ChangeNotifier to coordinate multiple widgets
  • Generates localizations by default using arb files
  • Includes an example image and establishes 1x, 2x, and 3x folders for image assets
  • Uses a “feature-first” folder organization
  • Supports shared preferences
  • Supports light and dark theming
  • Supports navigation between multiple pages
Sample generated Pigeon code

Breaking changes & deprecations

The following are the breaking changes in the Flutter 2.5 release:

Summary

In closing, thank you as always to the Flutter community around the world that makes all of this possible. To the hundreds of developers who have contributed and reviewed the 1000s of PRs in this update, here’s to the fruits of each of your efforts. Together, we’re working to transform the app development process for developers around the world so you can ship more, faster, deploying to the platforms you care about from a single codebase.

--

--

Flutter is Google's mobile UI framework for crafting high-quality native interfaces on iOS, Android, web, and desktop. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source. Learn more at https://flutter.dev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Sells

Chris Sells is a Google Product Manager on the Flutter development experience. He enjoys long walks on the beach and various technologies.