2022 is nearly over and Christmas is around the corner (for those who celebrate it). But there's still a bit of time to talk about Flutter.
So let me wear my Santa hat (🎅🏻) and come down the chimney...
with a sack full of Flutter news! 🎁
This month, my round-up covers upcoming changes to the Dart language, new widgets such as
NavigationBar, and interesting articles and packages from the community. 👇
It's been three years since the introduction of Null Safety in Dart. Since around 85% of Flutter apps are now using Null Safety, the Dart team has announced that sound null safety will be the only supported mode when Dart 3 lands in 2023.
Alongside this, interesting language features like patterns are coming soon, and this article covers all the details:
When writing unit, widget, and integration tests, the main goal is to assert that your code matches some expectations.
And in Dart, you can match values, types, errors, collections, streams, and much more.
Have you ever found code samples using
AnimatedBuilder for things that have nothing to do with animations?
As it turns out,
AnimatedBuilder takes a
Listenable argument, meaning you can use it for many different purposes.
This is quite confusing, and back in 2018 it was suggested that AnimatedBuilder should be renamed.
Four years later, this has been addressed by introducing a new
ListenableBuilderis currently available on Flutter master only and will ship in the next stable release.
For a long time,
BottomNavigationBar was the widget to use if you wanted to implement bottom navigation on mobile.
For a preview of all the changes introduced by Material 3, check this demo:
When people ask for good resources to learn Flutter, I often point them to the official YouTube channel, which contains many useful playlists such as Begin learning Flutter, Flutter in Focus, and Decoding Flutter.
And when it comes to state management, I particularly enjoyed this latest video, with a great visual explanation of how Riverpod providers can be used to manage state that can be accessed by multiple widgets:
Did you ever get frustrated using an app where the action buttons are too small or close together?
When this happens, it is a sign that developers did not implement accessibility properly.
To avoid making the same mistake in your Flutter apps, you can use the new accessibility_tools package, which comes with semantic label, tap area, and large font overflow checkers - making it easy to spot common accessibility issues.
The package is very easy to setup (just a one-liner), and I highly recommend it:
Since the last edition, I have published two in-depth articles. 👇
If you want your app to be performant and dispose of resources when they're no longer needed, you have to manage the lifecycle of your dependencies.
With the Riverpod package, this problem is (mostly) solved by using providers.
But have you ever wondered:
- when are providers initialized and disposed?
- what happens when a widget listens to a provider?
- how does Riverpod do data caching?
This article answers all these questions and shows you how to use provider lifecycle callbacks to implement custom data caching logic:
There has been a lot of buzz about ChatGPT - so much so that it has become of the biggest search trends on Google in 2022.
Some people argue that it is revolutionary and will make programmers obsolete. Others say it's just a toy and gets even basic things wrong.
Being very pragmatic myself, I think the reality is in the middle. So I decided to see how well ChatGPT does with Dart & Flutter coding tasks, and I compiled this detailed report with all my findings:
2022 is nearly over, and this year I've been honoured to help more Flutter developers than ever before.
If you missed any of my previous articles and want to catch up, you can find them in chronological order here:
And if you want to learn how the year went at Code with Andrea, stay tuned for my 2022 retrospective, where I'll share many of my insights as a content creator.
If you don't wanna miss this, you can sign up here: 👇