5 ms·
I'm very happy about this - lack of null safety and implicit downcasts are two of the biggest problems with Dart/Flutter, which I otherwise really enjoy working
by mindvirus 6y ago
I'm very happy about this - lack of null safety and implicit downcasts are two of the biggest problems with Dart/Flutter, which I otherwise really enjoy working in. I've gotten in the habit of adding "assert(x != null)" in all of my methods.
- cbolton 6y ago> I've gotten in the habit of adding "assert(x != null)" in all of my methods Is this not useless most of the time, since you'll usually get an exception (with stack trace) when the value is used?
- mindvirus 6y agoYeah, but at least this catches it early - i.e. if a branch/if-statement uses the field, it might not always be hit when testing things out. Unit tests _should_ catch these things, but so should the type system, and for my side projects I'm kinda fast and loose with testing for better or for worse.