Everything you need to know about Flutter 2
Alejandro R.
CEO & Co-Founder @Softedge - Healthtech & Fintech Engineering | AI | Nearshore Tech Partner
Almost 4 years after it first saw the light in 2017, Google has finally released version 2 of its popular cross-platform mobile development framework, Flutter.
Flutter is one of the most loved development frameworks by programmers around the world, and it also happens to be one of our favorite tools to build cross-platform mobile applications. Its widget-oriented approach, high performance, and stability are just some of the reasons we love it, and we couldn’t be more excited about the features this new version has in store.
As the jump in version numbers–from Flutter 1 to Flutter 2–suggests, this version isn’t just a minor release with some bug fixes and a few minor updates. On the contrary, it is a major upgrade with quite a few exciting new features, so let’s take a look at what they are and how they’re sure to make Flutter an even richer framework than it already is.
Flutter for the web
The first major upgrade brought on by this new version is production-quality support for web development. Up to now, web development with Flutter was in a beta stage, meaning that it could be done, but it wasn’t fully stable, which could introduce some risks if used for apps in production.
With Flutter 2, however, developers needn’t worry about web stability anymore. From now on, a development team can use this one technology to build highly performant mobile apps for Android and iOS, as well as high quality and stable web apps all in one go.
Not only that but the same code-base that was used to produce cross-platform mobile apps can now be used for web apps. This is a major game-changer, as it saves developers and companies a whole lot of time and effort, while also contributing to providing a uniform look and feel across all platforms.
To top it all, the Google team has focused on making Flutter web work for Single Page Apps (SPAs) and Progressive Web Apps (PWA), which are arguably the two most popular approaches to web apps being used right now.
Flutter for desktop
As if being able to use a single codebase to build apps for the web and for multiple mobile platforms wasn’t enough, Flutter 2 also includes a series of improvements for desktop app development.
Although this feature is not fully stable yet, it is expected to reach this state later this year, and has been given an “early release” status. This means that developers can look at it as a beta version, and start trying out some of the improvements included with Flutter 2, such as text selection pivot points, and upgrades to the TextField, TextFormField, ReorderableListView, and Scrollbar widgets.
Moreover, Google announced a series of partnerships to continue on improving support not just for desktop, but also for foldables and embeddable devices. These include a partnership with Canonical to advance on desktop support for Linux platforms, an ongoing collaboration with Microsoft to work on Windows devices, and a new joint effort with Toyota, which plans on using Flutter to build software for its vehicles.
Platform Adaptive Apps
As we have seen, Flutter 2 opens up a host of possibilities by freeing up new platforms for developers to deploy their apps. To the already stable iOS and Android platforms, it adds a new one: web development. And, by announcing a stable desktop release later this year, it adds three new platforms–Linux, MacOS, and Windows–in the near future.
This is an exciting landscape for Flutter developers, but it also brings up a lot of questions, the main one being how to make a single code base work for so many different devices.
With this in mind, the Flutter team announced the commission of the Flutter Folio app, which will work as a sample app developers can use to learn to make their own apps just as adaptive. For now, not a lot of documentation on it is available, but the team has announced that it will improve on this point and provide developers with more and better documentation and codelabs to help them navigate the new platforms Flutter 2 has to offer.
Google Mobile Ads
Together with the release of Flutter 2, Google announced the beta release of a new SDK called Google Mobile Ads for Flutter.
This new plug-in provides various new features related to mobile ads such as inline banners and native ads, as well as support for Admob and Ad Manager, two major marketing tools owned by Google.
This new and improved ad integration is a major upgrade since mobile apps so often rely on ads for monetization. By streamlining ad integration, Google Mobile Ads for Flutter will help developers focus on code, and worry less about how to monetize their apps.
New widgets and iOS features
Although at first glance, they might not seem as attention-worthy as the features described above, we’re also excited about some of the new widgets and iOS features that Flutter 2 has to offer.
On the iOS side, this new version brings improvements to various Cupertino widgets such as CupertinoSearchTextField, CupertinoFormSection, CupertinoFormRow, and CupertinoTextFormFieldRow. On top of that, it is now possible to build IPA files directly from the command line without having to open Xcode, making the process more convenient for Flutter developers.
As for cross-platform widgets, Flutter 2 introduces two new ones: AutocompleteCore, which serves as an MVP for the much-requested autocomplete functionality, and ScaffoldMessenger, which aims at solving various issues related to SnackBars. With the introduction of these two new features, Flutter is directly addressing some of the community’s most popular requests.
A new Dart with null-safety
If this is not your first time hearing about Flutter, then you surely know that it is coded using a programming language developed by Google called Dart.
Although the versioning of Dart and Flutter are not strictly tied together, both technologies definitely are, so it comes as no surprise that the announcement of such a major overhaul as Flutter 2.0 came with the announcement of a new Dart version: Dart 2.12, which the Google team has dubbed their “largest release since 2.0”.
The biggest feature in this new release is one that will be most welcome by Flutter developers: the introduction of null-safety. This means that nullable types will be from here on distinguishable from non-nullable ones, making it easy to prevent those pesky null errors that give developers so many headaches.
It is worth mentioning that this is a non-breaking change, meaning that you won’t have to go over your old code to change things unless you actually want to improve it by making use of this handy new feature.
FlutterDevTools
Finally, Flutter 2 makes it clear that debugging is important by renaming DevTools to FlutterDevTools and giving it the attention it deserves.
Of course, the name isn’t the only thing that has changed with this version. To start with, the team has introduced a new feature that prompts Android Studio, IntelliJ and Visual Studio Code to issue a warning when they spot a common exception.
Among other things, it has also added error badges that show up on FlutterDevTools’ tabs, and the ability to see images at higher resolutions than those being displayed.
Finally, they’ve once again answered one of the Flutter community’s requests by including fix layouts to the Layout Explorer.
To sum up, the changes introduced by Flutter 2 make it easier to develop apps that can be deployed to more platforms, improve mobile ad integration, provide a new much-requested feature to Dart, and improve debugging tools. All of this has us very excited to keep creating and improving projects with Flutter, and we hope it will motivate you to give this framework a try as well!