The great unicorn of software development is to have one language and framework that enables devs to code an app once and run it on any operating system and any type of device. Flutter has been aiming to do this since its inception, and today it gets quite a bit closer to that goal with the announcement of Flutter 2. The latest major update brings major enhancements for mobile platforms, adds support to desktop, and massively extends its capabilities on the web — among other things.
Flutter on desktop
If you've been paying reasonably close attention to Flutter, you've probably been hearing about some desktop support for quite a while. The stable releases began including the ability to build apps for macOS at the end of 2019, and work was already underway to add Windows and Linux to that list. Today's announcement formally adds those two into the stable track.
It's important to note that desktop support may be included in the stable releases now, but the Flutter team still considers it a "beta snapshot" while some issues and testing are further worked out. In other words, it's not quite production-ready, but it's getting close.
Much of this progress comes via contributions from Microsoft, Canonical (developers of Ubuntu), and many others.
Flutter is officially production-ready for the web. While support has been present and evolving for quite some time, Flutter 2 officially adds support for Progressive Web Apps (PWAs) and Single Page Apps (SPAs), new features like URL rewriting and keyboard shortcuts, and much more.
The framework now takes into account the target device to determine the best rendering method, such as HTML, Canvas, WebGL, or WebAssembly. And whenever possible, the platform-native functionality is automatically used, like keyboard shortcuts on desktop or gestures and software keyboards on mobile devices.
Improvements on Mobile
Most of the mobile-oriented additions are more granular, including new and enhanced controls for iOS and Android, including new Autocomplete and ScaffoldMessenger widgets.
One of the more prevalent additions is support for foldable devices. Microsoft has been a significant contributor to the project to enable development aimed at devices with either the standard foldable form factor or the side-by-side design seen in the Surface Duo.
Tons of individual changes and updates have been made across the tooling, including updated extensions for Android Studio (and IntelliJ) and Visual Studio Code, the debugger, and performance monitors.
Google Mobile Ads
Most developers eventually want to make money on their work, and if ads are the preferred monetization strategy, Google is all for it. Google Mobile Ads for Flutter is entering open beta today, with capabilities ranging from standard banner ads to interstitials and rewarded videos.
While there are a ton of big improvements to the Flutter framework, a new version of Dart also comes with some pretty substantial improvements. First among them is sound null safety, an enhancement to data typing that better handles null values to reduce the likelihood of crashing. To put it simply, types are now non-nullable by default, but there are additional nuances to the implementation.
Another major addition is Dart FFI, which enables the ability to integrate C-based libraries and compile high-performance code. This necessitated the addition of classic ABI-specific data types like structs, plus a tool for generating FFI bindings based on C header files.
This is just a high-level overview of the massive number of changes announced today with Flutter 2.0 and Dart 2.12, so check out the links below to read up for more details.