After watching Flutter Engage 2021 and the announcements the team made, Flutter will continue its upward trend in the cross-platform framework market.
On March 3rd, the Google Flutter team hosted a live event called Flutter Engage in order to show off the latest improvements that Flutter and Dart have to offer including a live keynote, community question and answer forum, and in-depth breakout sessions. Like most other tech events, this was a hype event to get new and experienced Flutter developers alike excited about the future of the framework. Well, it worked. After watching this live for about two and half hours and seeing some of the announcements they made, I’m thrilled for the future of Flutter. I’d like to share some of the announcements they made and why they can be game changers for the Flutter framework and community as a whole.
Flutter 2 release!
Flutter 2 is out as a stable release and it has a lot of potential over the original release of the framework. As a whole, this was the biggest announcement made by the team due to the gains the community will receive from going from version 1 to 2. Not only are we getting fairly standard improvements when a major release occurs, like performance, usability, and bug fixes, but the framework itself has just had a usage/perception change. As if a single framework that allows one codebase for iOS and Android wasn’t enough, Flutter 2 now supports 4 new platforms — Web, Windows, MacOS, and Linux! Web is production-ready in the stable release of Flutter 2, whereas the desktop platforms will need an early-release flag to enable while they continue to work on improvements. These new additions have changed the Flutter framework from a cross-platform mobile framework to a cross-platform portable framework, allowing a single code base to run an application on 6 different platforms. Wow, this is a massive enhancement for the community. Personally, I don’t think apps on these platforms will be perfect out of the gate and will likely run into edge case issues, but as more and more of the community converts or builds apps for these new platforms, it will only improve.
Flutter for Web is Stable
I wanted to specifically touch on the stable release of Flutter for the Web in Flutter 2. First, let’s talk about the improvements and then the caveats in use-cases.
The Flutter team added a whole new rendering engine, CanvasKit, in order to better handle graphic intensive visuals on the web and is more performant than the original HTML renderer in certain cases. Depending on the app, developers can choose which renderer to go with. The team also added better handling for routing and URLs, both in the browser URL bar and navigating through Flutter apps with deep-links on widgets. Another key feature of the web is visible RichText and the ability to copy or paste text fragments, and the team added pieces of this feature set with Flutter 2 including new specific widgets that can handle these features for us.
With the announcement of the web, it may seem like a good idea to build any website with Flutter but the team recommends specific types be built or converted for the web. Mostly they are recommending app-centric sites including progressive web apps (PWAs), single page apps (SPAs), and the conversion of existing mobile apps. If the website falls outside of these categories, it would be better to wait for future improvements before building it with Flutter. This is an unfortunate caveat, but should prevent a lot of headache by users building a site not in the intended use case.
Flutter for the web is the most important of the 4 platform additions. I have nothing against desktop apps and their use case is very real, but if Flutter can properly work for the web, the potential for the framework and community is exponentially increased. Install friction is a very real problem that can be avoided by having a web app version of the mobile or desktop app. The user base Flutter developers now have access to just multiplied tremendously with the introduction of web, no longer solely reliant on app stores. I am extremely excited about the future here, but not without my hesitations. I don’t think it will be a flawless experience and I’m sure there will need to be improvements made along the way, but I’m confident in the teams ability to deliver what the community needs.
Dart Recap + Null Safety
During the event, the team states that Dart is really the secret sauce that gives Flutter the boost it needs. First they do a recap as why the language can be so powerful with the image above, and then they talk about new additions and future goals. The biggest announcement relating to Dart was that Null Safety is now in the stable release of Dart 2.12.0, among other language additions such as late init variables, smarter flow analysis and required named parameters. What’s the big deal with null safety? Well, in addition to less quantifiable metrics like maintainability, readability and less bugs, it improves quantifiable metrics of performance and memory size. When code is converted to null safe, Dart can compile down to less instructions for the CPU (avoiding null checks) which results in faster code execution as well as fewer lines of code. Along with this, it guarantees that if code is completely migrated to null-safety, that a variable declared as non-nullable will never become nullable, aka SOUND null-safety. This helps prevent apps from getting into a state that is not expected from looking at the code. This change was so large that they mentioned it could have been a major release to Dart 3, but luckily for us they made it backwards compatible and a mix of null-safe and non-null-safe code can coexist in the same code tree. Before upgrading, make sure that all app dependencies are already on null-safe code otherwise it may be more of a headache to handle later.
New Developer Tooling
As a part of the releases mentioned above, the Flutter team has added some new tools in the Flutter developer toolkit. The first two mentioned in the keynote are mostly helper utilities to migrate from Flutter 1 to Flutter 2 as well as helping convert non-null safe Dart code to null-safe Dart code. These include command line options to migrate whole codebases using
dart fix or
dart migrate as well as inline editor quick-fixes. Both of these additions ease the burden of transitioning to the latest updates and will get developers up and running on both null-safe Dart and Flutter 2 quickly. On top of these quick migration tools, the team improved the developer and debugging toolset as well. Instead of opening a web browser to debug Flutter apps, they embedded the dev tools directly inside of the code editor. This also allows clicking directly on an error and auto-navigation to the Flutter inspector tool. Awesome!
In addition to moving some of the tools into the editor, they added some new profiling options for our apps that can investigate performance, cpu, memory. The keynote showed off a “App Size” inspector which allows drill-down into what parts of the application are taking the most memory. That’s a big win considering a big qualm with Flutter is the base package memory footprint, so now we can see exactly what is consuming memory.
Anecdotes, Numbers, Name Drops, and Other Exciting News
I’d say the above were the biggest splashes at the keynote, but they really went over a ton of content and hit on some really cool stuff that’s happening with Flutter. I’ll do a short bullet style recap below, but I’d really recommend watching the keynote if you have time!
- Flutter and other power player partnerships. During the event, Flutter announced a few key partnerships that will improve the framework and continue to push its capabilities. Toyota will be using Flutter for their in-car infotainment systems, paving the way for using Flutter in embedded scenarios. Canonical is partnering with the team to help work out issues and make improvement on Linux desktop environments along with a Microsoft pairing to improve Windows desktop apis and experiences. These are amazing partnerships to have for the Flutter team.
- One of many Google apps that is now built with Flutter, Google Pay gives a rundown of why they switched to Flutter and if it paid off. Spoiler — it did. Check out these numbers: 1.7 million lines of code down to 1.1 million. Tech debt went DOWN 90% per engineer. 20% more productive developers. A massive increase in team engagement and productivity since all mobile developers are now working on the same code base.
- The team showed off a pairing with GSkinner development company which built Flutter Folio, a scrapbooking app, on multiple platforms including the web. Check it out here!
- Major updates for Firebase and Flutter plugins. All packages are updated to include sound null safety.
- Google Mobile Ads SDK for Flutter (beta) — new ad formats! Unifying Google AdMob and Google Ad Manager depending on size. This finally provides a better inline ad experience for Flutter developers!
Further Reading and Watching
Check out these articles to really dive into all the improvements from Dart 2.12 and Flutter 2 announcements.
What’s New in Flutter 2.0
Flutter web and Null Safety move to stable, Flutter desktop moves to beta and so much more!
Flutter web support hits the stable milestone
Publish to web and mobile from the same codebase
The event was recorded along with other breakout sessions and can be found at the link below. I’d really recommend watching the keynote and exploring any of the breakout sessions that you find interesting!
The Future is Flutter
Like I mentioned at the top, I personally think it’s a really exciting time to be a Flutter developer or begin learning it and Flutter Engage showed that. The new additions to the language and framework have the potential to bring a lot of attention to Flutter and should be for the better! I hope you enjoyed my quick recap. What do you think of the future of Dart and Flutter or the event itself? Comment below!