2 ms·
Dart isn't perfect, and I think at the least would really benefit from Union types. There are some open issues related to these things though: https://github.
by danbalthasar 8y ago
Dart isn't perfect, and I think at the least would really benefit from Union types. There are some open issues related to these things though:
https://github.com/dart-lang/sdk/issues/4938 https://github.com/dart-lang/sdk/issues/4938 (Unions)
https://github.com/dart-lang/sdk/issues/421 https://github.com/dart-lang/sdk/issues/421 (Tuples)
Please feel free to contribute here! That said, it's certainly possible to work around these things. Dart has a tuple library (https://github.com/dart-lang/tuple https://github.com/dart-lang/tuple) which covers a lot, and much of what you'd use Unions for can still be covered by accepting `Object` or `dynamic` parameter types and doing some typechecking.