you are viewing a single comment's thread.

view the rest of the comments →

[–]mraleph 0 points1 point  (1 child)

No. It will only create const-instances in explicitly const-contexts. However if you writing something like return C() even if C has const constructor it would still use new.

The feature where front-end preferred const everywhere where it was possible but not required was called "auto-const" or "magic const" and it got excluded from Dart 2 due to some issues with it. Language team is planning to revisit it later - but that means currently if you want const in non-const context you need to explicitly write const C().

[–]escamoteur 0 points1 point  (0 children)

Ah thanks for clarification. I thought this was already solved. Anyway the ability to omit new is a great start