Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Flutter 2 is Production-Ready for the Web, Adds New Platforms

Flutter 2 is Production-Ready for the Web, Adds New Platforms

This item in japanese


A major update to Google's cross-platform UI Toolkit, Flutter 2 stabilizes Web support and adds new platforms, including foldable, embedded, and desktop. Alongside it, new Dart 2.12 brings null safety and Dart foreign function interface (FFI). 

Flutter has supported mobile platforms iOS and Android since its launch. While introduced as a technical preview in Flutter 1.5, support for Web and desktop apps had not moved past that stage. Now, with version 2, Flutter officially supports Web apps targeting Chrome, Firefox, Safari or Edge and adds support for creating native apps for Windows, macOS, and Linux.

The web platform has evolved to encompass richer platform APIs that enable highly-sophisticated apps with hardware-accelerated 2D and 3D graphics and flexible layout and paint APIs. Flutter’s web support builds on these innovations, offering an app-centric framework that takes full advantage of all that the modern web has to offer.

During the relatively long technical preview phase, Google has worked extensively to improve Flutter's performance for the Web by building a new CanvasKit-powered rendering engine using WebAssembly, while also ensuring that experiences built for the Web can be run seamlessly on desktop and mobile devices. Initially, Flutter focuses on two Web scenarios, including progressive web apps (PWAs) and single page apps (SPAs).

Flutter 2 also introduces support for foldable devices, which has been announced separately by Microsoft Surface team. The key idea to support foldable devices is that of "display features", i.e. areas of a display that are not functional, including cutouts, hinges, and folds. To avoid display features, developers can position their Flutter UI objects inside the display so-called "safe area", which is automatically handled by the system.

According to Microsoft engineers, in many cases adding support for dual-screen to an app will be as easy as using a TwoPane widget, which provides a simple way to scale up a design. This makes it easy to show one or two widgets according to available space, hence its name. Flutter foldable support is still experimental and has not been merged yet into the official Flutter repo, though.

Along with Flutter 2, Google has released Dart 2.12, a new version of the language that is used to create Flutter apps. At the language level, Dart 2.12's most relevant feature is null safety, which can be enabled to make all variable declarations to be non-nullable by default unless they add a ? suffix to the type:

var i = 42; // non-nullable int
int? n = null; // nullable int

if (n == null) {
  return 0;
if (n > 0) { // here n has been promoted to a non-null int


Another important feature in Dart 2.12 is Dart FFI, which makes it possible to call into C libraries from Dart code. While Dart FFI is considered stable and ready for production use, there are a number of fine-grained features that are still in the workings, including support for ABI-specific data types like int, long, size_t; inline arrays in structs; packed structs, and so on.

Flutter 2 includes many new and improved widgets too, for both iOS and Android. For example, AutoCompleteCore simplifies the implementation of auto-complete behaviour in your apps. A new Add-To-App feature is specifically meant to enable using Flutter in only parts of your existing apps, which makes it possible to reuse your Flutter code base even if your mobile apps are not 100% Flutter.

In order to reduce the impact of backward-incompatible changes on existing code bases, Flutter 2 is launching Flutter Fix. This is able to flag any parts of code where a fix can or should be applied, thus making it easier on developers to bring their code bases up-to-date with any API changes, i.e., replacing a deprecated API.

As a final note, Flutter adoption continues to grow, states Google, with over 150,000 apps created using Flutter and made available through the Play Store. Google engineers themselves have been hard at work porting many existing Google apps to Flutter, including Stadia, Google Pay, Google One, and the Google Nest Hub. Additionally, there are 15,000+ packages available in the Flutter ecosystem including new SDKs for Google AdMob and Firebase, and others from Amazon, Microsoft, Square, etc.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p