This week in Flutter #17
I am not a big fan of Medium for tech articles. It is a closed platform, with a horrible user experience - try to copy and paste some terminal command in a medium article and let me know.
So I was pleased when I learned that Hashnode [got (more) [funding](https://townhall.hashnode.com/dollar67m-in-series-a-funding-to-build-the-next-gen-developer-blogging-community)](https://townhall.hashnode.com/dollar67m-in-series-a-funding-to-build-the-next-gen-developer-blogging-community). Hashnode is a blogging platform for developers, like Dev.to. If you are starting a tech blog, and you do not want to host your own website then look at those two before going to Medium.
- Michele Volpato
An approach to error handling on Flutter
Rafael Áquila shows a couple of ways to handle errors in a Dart program. He starts with the usual “print on catch” code, and then he provides the
ResultWrapper<T> class that you can use to hold the error or the expected result. Finally, he also shows a functional approach using Dartz, a functional programming package for Dart.
How to Parse JSON in Dart/Flutter with Code Generation using Freezed
As a continuation of the article from last week, Andrea Bizzotto pushes JSON parsing to the limit with code generation. I am all for automating repetitive tasks, but I do not use code generation intensively. I find the needed annotations annoying, and not easy to understand for a new member of the team. I still use it sometimes, and when I use it I commit the generated files to the repository. Andrea argues that the code reviews become harder to perform, but you can easily exclude generated files from the merge diff.
The Ultimate Flutter Layout Guide
Ok, I am not sure this is the “ultimate” guide, but it is a good idea to keep it next to you when you really cannot understand why that container is not properly aligned/sized/visible. Thanks, Aditya Sharma.
Keys In Flutter - UniqueKey, ValueKey, ObjectKey, PageStorageKey, GlobalKey
In this comprehensive article, Dhruv Nakum talks about
Keys in Flutter. We have seen keys in a previous issue, but Dhruv goes straight to the point in this article.
Creating a custom progress indicator
Get your hands dirty with some
CustomPaint and create a new progress indicator with this article by Daniel Ko. Warning: there is math in there.
Flutter Timer vs Ticker: A Case Study
Andrea Bizzotto publishes a lesson from his Flutter Animation Masterclass, where he explains why you should use
Ticker instead of
Timer when building a stopwatch. I bought the course, and I must say that it is well done. If you are learning Flutter, and want to know more about animations, you should consider it. Just to be clear: I am not affiliated with Andrea and I paid full price for the course.
A guide to theming your app in Flutter
A quick and easy article about getting started with
[adaptive_theme](https://pub.dev/packages/adaptive_theme) and Riverpod to handle themes in your app, by Chinedu Imoh.
Master The Art of Dependency Injection 🐱👤
Dependency injection is important to keep your code loosely coupled and highly testable. Are there special considerations about dependency injection when working on a Flutter app? We could have a very deep widget tree, forcing us to inject the dependency from the root to the leaf. Read more about dependency injection in Flutter from Dhruv Nakum.
A tool like Crashlytics but for threats. You deploy it with your app, and it notifies you about attempts to clone it or reverse engineer it. I am not sure about what you can do after being notified. I consider the apps I distribute as at risk of being studied and cloned. You should not have secrets in the app, because it runs on a device you have no control of. Secrets should be managed only on platforms you fully control, like a backend server.
Flutter Hot Reload
If you want to know how Hot Reload works, and how it has been improved in Flutter 2.2, read this article by Jens Johansen.
Yellow underline text | Decoding Flutter
It happened to everybody. In your app, often in a text hero widget, your text has two yellow underlines. It happens when a
Text widget does not have a
TextStyle. Filip Hráček explains it to you and gives you a solution in this short video.
That’s it for this week.
If you want to comment on any of this week’s entries, you can do it in the comment section below.
Have a bug-free week,
- Michele Volpato