# This week in Flutter #17



I am not a big fan of Medium for tech articles. It is a [closed platform](<https://opensubscriptionplatforms.com>), with a [horrible](<https://medium.com/@nikitonsky/medium-is-a-poor-choice-for-blogging-bb0048d19133>) 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 ](<https://townhall.hashnode.com/dollar67m-in-series-a-funding-to-build-the-next-gen-developer-blogging-community>)(more) [funding](<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](<https://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.

<small>- Michele Volpato</small>

## 🧑‍💻 Development

### [An approach to error handling on Flutter](<https://aquilarafael.hashnode.dev/an-approach-to-error-handling-on-flutter>)

[Rafael Áquila](<https://hashnode.com/@aquila>) 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&lt;T&gt;` class that you can use to hold the error or the expected result. Finally, he also shows a functional approach using [Dartz](<https://pub.dev/packages/dartz>), a functional programming package for Dart.

---

### [How to Parse JSON in Dart/Flutter with Code Generation using Freezed](<https://codewithandrea.com/articles/parse-json-dart-codegen-freezed/>)

As a continuation of the [article](<https://ishouldgotosleep.com/this-week-in-flutter-16/#how-to-parse-json-in-dartflutter-the-essential-guide>) from last week, [Andrea Bizzotto](<https://twitter.com/biz84>) 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](<https://git-scm.com/docs/gitattributes#_defining_macro_attributes>).

---

### [The Ultimate Flutter Layout Guide](<https://blog.adityasharma.co/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](<https://hashnode.com/@BetaPundit>).

---

### [Keys In Flutter - UniqueKey, ValueKey, ObjectKey, PageStorageKey, GlobalKey](<https://dhruvnakum.xyz/keys-in-flutter-uniquekey-valuekey-objectkey-pagestoragekey-globalkey>)

In this comprehensive article, [Dhruv Nakum](<https://twitter.com/dhruv_nakum>) talks about `Key`s in Flutter. We have seen keys in a [previous issue](<https://ishouldgotosleep.com/this-week-in-flutter-11/>), but Dhruv goes straight to the point in this article.

---

### [Creating a custom progress indicator](<https://dev.to/danko56666/creating-a-custom-progress-indicator-346e>)

Get your hands dirty with some `CustomPaint` and create a new progress indicator with this article by [Daniel Ko](<https://twitter.com/danko566>). Warning: there is math in there.

---

### [Flutter Timer vs Ticker: A Case Study](<https://codewithandrea.com/articles/flutter-timer-vs-ticker/>)

[Andrea Bizzotto](<https://twitter.com/biz84>) publishes a lesson from his [Flutter Animation Masterclass](<https://codewithandrea.com/courses/flutter-animations-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](<https://blog.logrocket.com/theming-your-app-flutter-guide/>)

A quick and easy article about getting started with `<a href="https://pub.dev/packages/adaptive_theme">adaptive_theme</a>` and [Riverpod](<https://pub.dev/packages/flutter_riverpod>) to handle themes in your app, by Chinedu Imoh.

---

### [Master The Art of Dependency Injection 🐱‍👤](<https://dhruvnakum.xyz/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](<https://twitter.com/dhruv_nakum>).

---

## 🛠 Tools

### [freeRASP](<https://github.com/talsec/Free-RASP-Community>)

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.

---

[...]

[Read the rest on ishouldgotosleep.com](https://ishouldgotosleep.com/this-week-in-flutter-17/)


