Sandro Maglione Profile picture
The Coding Explorer 💻・Sharing patterns to build type-safe web & mobile apps・Typescript・@EffectTS_・React・XState Helping devs at https://t.co/5ongGuhjEU 🚀
Oct 18, 2022 15 tweets 4 min read
Error handling is hard, harder than you think 🤔

Let's just see a simple example 💁🏼‍♂️

In how many ways can this #dart code below fail?

The answer will surprise you 👇🧵 Image Note: fail can mean different things ☝️

Here we mean anything that will crash the app (if not handled)

Errors or Exceptions 👇

Oct 17, 2022 12 tweets 4 min read
What if your #flutter app fails? Should you throw? Error? Exception?

#dart gives you both Error and Exception 🎯

But how do they work? Which one should you choose? 🤔

Here is the answer 👇🧵 Error & Exception ‼️

#dart has both of them, but they are not the same 💁🏼‍♂️

👉 Exceptions: conditions that you can plan ahead for *and catch*

👉 Errors: conditions that *you don’t expect*