Marco
Marco

Reputation: 593

Strange and unexpected behavior of the constructor of an enum in Dart

I’m writing a code with a enum.

You can run the code here in a DartPad.

The enum constructor has a optional named parameter codeAndDescription. An enumeration value does not specify the value of parameter codeAndDescription (which by default should be an empty string). If I print this value, it does not print an empty string, but 'null'. Does anyone know if this is a bug or if I’m wrong?

Thank you very much!

Upvotes: 1

Views: 163

Answers (1)

julemand101
julemand101

Reputation: 31219

It is a know bug, as mmcdon20 also mention, which have been fixed for the upcoming Dart 2.18 version. This version is right now in beta.

You can find the bug report here: https://github.com/dart-lang/sdk/issues/49216

Upvotes: 1

Related Questions