Demystifying Union Types in Dart, Tagged vs. Untagged, Once and For All

I have spent a significant amount of time writing this article, where I explain Union Types (Tagged and Untagged) and will explore the problems and solutions with them from different languages’ points of view and also, what Dart offers and how you can tackle them in Dart for your next Flutter project.

I hope you will enjoy this article and it helps you understand this topic better. I will also be happy to receive your feedback on how to improve.

Thanks for reading in advance.

Link to article: Demystifying Union Types in Dart, Tagged vs. Untagged, Once and For All | DCM - Code Quality Tool for Flutter Developers

Demystifying Union Types in Dart, Tagged vs. Untagged, Once and For All

6 Likes

Great article!

I think here is a slight mistake

As discussed in this article, one of the common issues with untagged unions in languages without exhaustive pattern matching (like Dart, which lacks built-in untagged union type) cannot ensure that all possible cases are handled at compile time

I think untagged unions cannot checked exhaustively or am I mistaken here?

1 Like