Flutter 2 is here, I had to check it out.

Matt Jones | April 10, 2021

Key points:

> Development can now be done on Windows, MacOS, Linux, and the Web.  

> Null safety with Dart 2.12

> Flutter web is now stable


Desktop Development


My first GUIs were made in Java Swing (not my idea). It was a natural choice since we were learning Java in school and it’s supposedly easy and simple. I pray I never have to make another Java Swing GUI again. It’s not just the terrible 90s theme. It's also the fact that you spend more time trying to connect your functions to buttons than writing the application itself. Well, those days are over. Flutter is designed to be easy, so making a front end for any application is a breeze and looks good.


I made my own Windows application, and it was way easier than I would have originally thought (check my project here). This is awesome because it allows me to make projects that I know I can move over to mobile or the web, without having to learn native mobile development or redesign a website. Sure there will be issues and platform-specific considerations, but even if 50% of code transferred, I’d call that a win. Plus, I’m no designer, so having the material theme built-in makes it look good without trying.


Desktop development is now stable, but with an early release flag. This just sounds like an extended beta to me, but it won't be long until it’s stable enough for companies to start adopting it for their applications. There has been a ton of improvement in the widget system to adapt for desktop applications, such as responsive controls for pointers, keyboard integration with inputs, and dragging ability for widgets, such as lists. There are also built-in command-line arguments with some widgets on desktop-specific builds. All this just shows how Google wants Flutter to be adopted on all platforms.


Recently it was announced that Flutter will be the default choice for future apps that are created by Canonical (Ubuntu). This is big news since Ubuntu is probably the biggest (if not the most well-known) Linux distro. With many developers using Linux, it can only grow more in popularity as more Flutter applications come out.


Here’s a Flutter Folio that was put together to show how one code base can publish on 3 form factors, 5 OS’s, and the web while reusing 95% of the code. Check the video.


Null Safety


Dart is a strongly typed language on design. We’ve seen this trend in other recent languages such as Typescript, Go, and Rust. Now with the improvement to being null safe, it only strengthens the type system by distinguishing nullable types from non-nullable types. As a developer, this is awesome, helping prevent preventing potential null errors. Catching these errors in development and knowing my code is less likely to randomly crash is huge when putting big projects together. Think of this as a huge safety net for later on, when your codebase has grown to the point where you don’t remember what you wrote 3 months ago. We write tests throughout our development to make sure our code is going to work throughout the project and if it doesn’t, we know where to look. Well, when you write with null safety, you know that it’s one less thing that can go wrong throughout the whole process and one less thing to maintain later. The frustration of writing better code upfront is worthwhile when you know what you write is far less likely to fail or have issues later. Who doesn't love it when something just works as intended.

Moving all the existing packages over to null safety will take some time. Making my desktop application I found this out right away. Currently, almost all major packages have moved over to or offered a null safe option, but I think this will take a while for all the packages to fully migrate and work together safely. The Dart team has thought of this and has made tools such as the ‘quick fix’ tool that are built in to help ease the transition from old code bases.


Web Stability


Flutter takes advantage of Google’s Skia graphics library. We already see the results of this with the previous Flutter applications but now it’s been improved. Using CanvasKit and WebAssembly, Flutter now allows more flexibility and the ability for web developers to create whatever application they would like. In this new stable build, there has been a bunch of new specific widgets such as the link class that improves the feel and functionality. Just as I discussed above, Google is trying to make Flutter adaptive to any platform, and the web is a huge platform with tons of complexities.


Build It



I’ve been looking forward to making a desktop application, partly for the novelty of it and partly because I never want to write a Java GUI again. For this project, I made a Windows desktop app because that’s currently what I’m using most of the time for development. Github also has a Graphql API that is open and extensive. I’ve never used Graphql since it’s so new and this was a good opportunity to check it out. So far, I like it a lot and will be using it in the future.


To check out the project click here


To check out the explained video click here.

Made with Django and ❤️