December 2022: Road to Dart 3, Accessibility Tools, new Material 3 Widgets, and ChatGPT

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! 🎁

Flutter News

This month, my round-up covers upcoming changes to the Dart language, new widgets such as ListenableBuilder and NavigationBar, and interesting articles and packages from the community. 👇

📝 The road to Dart 3: A fully sound, null safe language

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:

📝 Assertions in Dart and Flutter tests: an ultimate cheat sheet

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.

In fact, the matcher package offers dozens of different APIs for writing expectations, and this article by Anna Leushchenko includes a detailed cheat sheet. Not to be missed! 👇

🐙 ListenableBuilder is here!

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 ListenableBuilder class:

ListenableBuilder is currently available on Flutter master only and will ship in the next stable release.

🎬 NavigationBar (Widget of the Week)

For a long time, BottomNavigationBar was the widget to use if you wanted to implement bottom navigation on mobile.

But as part of the ongoing migration to Material 3, we now have a new and improved NavigationBar:

For a preview of all the changes introduced by Material 3, check this demo:

🎬 Managing State in Flutter - Introducing Flutter

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:

🛠 Accessibility Tools Package

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:

Latest on Code With Andrea

Since the last edition, I have published two in-depth articles. 👇

📝 Riverpod Data Caching and Providers Lifecycle: Full Guide

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:

📝 Dart & Flutter with ChatGPT: Is it worth it?

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:

Until next time

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: 👇

Want More?

Invest in yourself with my high-quality Flutter courses.

Flutter Foundations Course

Flutter Foundations Course

Learn about State Management, App Architecture, Navigation, Testing, and much more by building a Flutter eCommerce app on iOS, Android, and web.

Flutter & Firebase Masterclass

Flutter & Firebase Masterclass

Learn about Firebase Auth, Cloud Firestore, Cloud Functions, Stripe payments, and much more by building a full-stack eCommerce app with Flutter & Firebase.

The Complete Dart Developer Guide

The Complete Dart Developer Guide

Learn Dart Programming in depth. Includes: basic to advanced topics, exercises, and projects. Fully updated to Dart 2.15.

Flutter Animations Masterclass

Flutter Animations Masterclass

Master Flutter animations and build a completely custom habit tracking application.