Quantcast
Channel: Dart - How to create custom types on the fly like in Typescript? - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Dart - How to create custom types on the fly like in Typescript?

$
0
0

I want to create a custom type in Dart like I would do in typescript. This type should be a subtype of String, accepting only some values.

For example, in Typescript I would do:

type myType = 'HELLO' | 'WORLD' | '!'

How can I do the same stuff in Dart?


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>