Google's open-source UI development kit and framework, Flutter that started gaining traction since its inception in 2017, has now grown up to Flutter version 2.0. Flutter 2.0 was announced on 3rd March 2021 during Flutter Engage as bringing another milestone on the cross-platform UI toolkit along with a myriad of changes. The new version of Flutter is strengthened to make you move beyond mobile using the same codebase.
The latest Flutter update empowers you to make apps wherever they belong — the desktop, web, and growing form factors like foldable. It doesn't stop here.
You can now employ the codebase to build native apps using Flutter for Android, iOS, macOS, Windows, and Linux. What's more? With Flutter for web app development, you can target Edge, Safari, Firefox, or Chrome browsers.
Plus, Flutter lets you create beautiful experiences where your products and brand come to the forefront, including TVs, cars, smart home appliances. With Flutter, you can offer the most handy and pervasive experience for a digital world. If you plan to use Flutter for Android and iOS app development or web app development, check out Flutter 2.0's bits-and-bytes below.
What's new in Flutter 2.0?
Flutter For Desktop Application
The new Flutter version allows you to build and render a native-like app experience even on desktop applications. They have brought many enhancements to match the native experience on desktop, including mouse dragging with accuracy, a built-in context menu (TextFormField and TextField widgets for Cupertino and Material design languages), text selection pivot points, and other native-like text editing operations. Grab handles are also available in Flutter for desktop applications to make it easier for developers to move items in the ReorderableListView widget.
Moreover, customizing apps according to requirements becomes straightforward with the new Scrollbar widget with numerous engaging features. The community is approaching full production-quality release of the Flutter desktop. So, you can expect support for integration with native top-level menus, accessibility support, and native-like text editing.
Flutter for web app development
With the Flutter 2.0 release, the web support has upgraded from beta to the stable channel. In this initial stable release, the code reusability of Flutter has touched another level for the web. It allows you to build web apps similarly as you build iOS and Android apps with Flutter. However, the release focuses on three app scenarios.
- Progressive web apps (PWAs) combine the web's reach with the capabilities of a desktop app.
- Single page apps (SPAs) that load once and convey data to and from internet services.
- Expanding existing Flutter mobile apps to the web, allowing shared code for both experiences.
Moreover, Flutter offers a foundation to develop rich interactive web applications by leveraging the web platform's strengths with focusing on performance and improvements. Also, there is a CanvasKit-based renderer added to its HTML render and web-specific features like Link widget to ensure the app runs like a web app in the browser.
See more details about the Web Support stable release in Flutter's web support blog post.
Flutter Instances with Add-To-App
Flutter developers have understood that not everybody gets the luxury of starting a brand new app, so they offer an Add-to-App feature. It lets you reap all benefits of Flutter by adding it to your existing Android and iOS apps. By doing so, you can reuse the Flutter codebase for both platforms while preserving the native codebase as well.
They have brought new APIs to resolve interweaving Flutter and native screens navigation states' difficulties. These are in preview on the beta channel documented on Flutter.dev along with sample projects demonstrating this new pattern.
Google Mobile Ads To Beta
After piloting the plugin in a private beta program, they have released an open beta for Google Mobile Ads SDK for Flutter. The brand new plugin offers inline banner and native ads with existing ad formats like overlay banner, interstitial, and rewarded video ads. The SDK unifies AdManager and AdMob support to allow you to tailor ads of any size that suit your scenarios. Consequently, with Flutter, not only app performance will be heightened but your revenue, too.
Support For Sound Null Safety
With the Flutter 2 release, Google also announced Dart 2.12 with significant Sound Null Safety support. It strengthens the type system by distinguishing null exceptions from non-nullable types. The feature enables developers to avoid a class of bugs that are hard to spot and write high-performing code. Also, the Sound null safety support is now stable in Flutter 2. Fetch more details on Dart 2.12 from here.
Flutter Folio
Flutter 2.0 supports 3 platforms for production applications (Web, iOS & Android) and 3 in beta (Linux, macOS & Windows). Now it seems complicated to write an app that adapts itself to different shape factors (small, medium & large screens), multiple-input modes (touch, keyboard, & mouse), and different platforms (mobile, desktop & web). To answer this loaded question, Google has built a sample app collaborating with gskinner that illustrates everything. Flutter Folio is a scrapbooking app that is designed by an Edmonton-based award-winning design team for all your devices.
Small-screen experiences capture content; larger screens support editing with desktop and tablet-specific idioms; and the web experience is tailored for sharing. All these custom experiences are built on the same codebase, which is open source. The source code for Folio is available for everyone to peruse.
Final Words
Flutter 2.0 has plenty of great features and deals for nearly all platforms that we could not fit into one post. They have also enhanced the Flutter extension for Android Studio/IntelliJ and Visual Studio. In fact, since Flutter 1.0 release, Flutter developers have closed 24,541 issues and merged 17,039 PRs from 765 contributors.
Only the raw list of pull requests merged is of a 200-page document! However, you can head over to Flutter 2 separate technical blog to learn about the latest features and performance improvements. And if you are amazed by Flutter 2 features, hire Flutter developers to develop your brand's mobile applications.