Sdk: Allow testing for type enum

Created on 25 Dec 2018  路  2Comments  路  Source: dart-lang/sdk

As far as I know, all enums have the same properties / methods. In other words, they all act the same. I see no reason why we shouldn't be able to test if a value is an enum and then perform enum-y tasks on it.

For example, I have a BehaviorSubject that persists values on add to shared_preferences in Flutter. I support numbers, strings, and lists of strings. I'd like to also support enums but I can't because I cannot test if an incoming value is an enum.

area-language

Most helpful comment

This would also enable extension methods on enums.

All 2 comments

This would also enable extension methods on enums.

We can already do extension methods on enums. Use them all the time.

Or maybe you're talking about a 'base class' of Enum? Cos that would be cool.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DartBot picture DartBot  路  3Comments

DartBot picture DartBot  路  3Comments

xster picture xster  路  3Comments

nex3 picture nex3  路  3Comments

rinick picture rinick  路  3Comments