How to encode Algebraic Data Types in current Dart?

Viewed 393

How to encode Algebraic Data Types current in Dart?

Algebraic data types are also known as:

Question is, how do I implement it in current Dart / Flutter, given that support for it has not landed yet (see issue #349)?

There are some approaches explained on the internet, e.g. I've found the match library, the sealed_unions library, the if-else approach, and some more trickier techniques.

But I'd really love some more expert opinions on what to choose, and why did you chose it. Thoughts?

0 Answers
Related