A couple of days ago, it was the Flutter Engage, the reference online conference for the Flutter community, something like the WWDC or the Google IO for iOS and Android.
This was a long-awaited moment, as there were several technologies that could reach “stable” status, after a long time purging under the “beta” label. Among them, Flutter 2.0, the new version of Dart, which we expected to be called Dart 3.0, but it was in 2.12 as well as Flutter for other platforms (not mobile), such as web and desktop.
In this post you will find Flutter 1 vs Flutter 2 under the below checkpoints:
- What’s new in Dart language
- New Targets
- Flutter Web: trigger
- Flutter Embedded: the last frontier
- Flutter Desktop
- Conclusions
What’s new in the Dart language
For months, Google has been promising several additions to Dart, but without ever giving a delivery date, in plan “it will be ready when it is ready.” Honestly, I wasn’t expecting it to come out so soon, and I was frankly scared that it would come out with a week remaining for my Flutter module in the mobile bootcamp. Fortunately, there is no unlucky fool, and no further substantial changes are expected in the coming months.
There are three things you miss when you come from Swift or Kotlin:
- Null safety
- Extensions
- Data Classes
We have had number two for a long time and null safety has been in the oven for months. Finally we can now use Optional, with a syntax very similar to Swift or Kotlin. Best of all, you can stick with your old code which will continue to compile. There is a really good tool for migration, and you can do it when it suits you best.
Following the “least surprise” principle, the syntax is exactly the same as in Swift or Kotlin.
What does not change is the error handling, which in principle is still done through exceptions: there is currently no Result <>.
Data Classes allow you to automate the creation of common methods, especially in the model, to avoid writing the same code a thousand times. This is not yet available nor is there a date for it. However, Dart has very good facilities for metaprogramming (code that generates other code) and that is the path that Google wants to go. I wouldn’t be surprised if it was ready in a year.
Meanwhile, a good option is Moor, a kind of Room (which in turn is a Core Data for the poor) for Dart.
New Targets
One of the consequences of the Flutter GUI architecture is that the final result could, in theory at least, be generated in other formats, creating other subclasses of RenderObject.
It seems that Google took it seriously and now we have the following targets for your flutter app development:
- Mobile
iOS
Android - Desktop
Linux
macOS
Windows - Web
The desktop versions are still pretty green, but there are already companies like Canonical and Microsoft working hard on it.
We have a great hope that the flutter 2.0 update displaces that horror that is Electron and we no longer need 8 Gb to open a text editor.
The big news has been the launch of Flutter Web as a stable platform. Let’s take a look at it.
Flutter Web: trigger
Until yesterday, when you create a project in Flutter, it creates two targets, iOS and Android. Now you can add one more, the web.
Unfortunately, what Google calls stable is what we would call “lacking a boil.” The size of the resulting app is disproportionate and the performance still leaves to be desired. Of SEO, better not to mention.
Let’s leave it in that it has potential, for certain types of applications, and that time will tell. At the moment, it is classified as a trigger.
Flutter Embedded: The Last Frontier
Another target, which is not available to everyone but which is very interesting, is that of embedded, or embedded devices. Have you ever thought about how your car software interfaces are made?
This is one of the biggest embedded device markets, and C ++ and QT reign unquestionably here. So far, since the world’s largest automaker has jumped on the Flutter and Dart bandwagon: Toyota. From now on, the software with which the driver and passengers interact will be created with Flutter and Dart.
In this sense, the new Dart FFI package is very welcome, which provides a new synchronous and simple mechanism for interacting with C code.
This is excellent news for every mobile developer, since it opens the door to a whole market of devices with characteristics similar to mobiles, but which until now used a totally different stack.
Flutter Desktop
Here the main protagonist has been Canonical, the creator of Ubuntu. It has decided to bet everything on Flutter as the default tool for developing desktop applications in Ubuntu. He is contributing to the Flutter repo, focusing on multi-window support (currently nonexistent) and is rewriting the Ubuntu installer in Flutter.
This is excellent news that fills me with hope that we will be rid of the Electron curse. Additionally, Microsoft is also collaborating to better integrate it into the Windows environment. I’m crossing my fingers and praying novenas nonstop.
I think that Flutter has more sense and future on the desktop than on the web, due to its characteristics and Javascript’s immortal zombie condition.
Conclusions
It is very likely that Google has found the right product at the right time and that we have an excellent tool for cross-platform development. The fact of delegating part of the weight of the development of non-mobile targets to other companies is good news, since there are still things to improve in the core of the platform. For example, it would not hurt to look at what Apple has done with SwiftUI, which has achieved greater simplicity for the developer.
The state of the state management is also something that has to be urgently improved with a simple and powerful solution, which has the formal support of Google.
However, I believe that it is a tool with a long journey and that will make it easier for many companies to reach a greater number of devices with quality and with controlled equipment and resources.
If you want to learn to master Flutter and Dart to enhance the development of mobile Apps, discover our Full Stack Mobile Bootcamp. Download the agenda and know every detail of the program.