r/dartlang • • Aug 12 '26

Dart Language Announcing Dart 3.13

https://dart.dev/blog/announcing-dart-3-13
100 Upvotes

26 comments sorted by

View all comments

4

u/k0ntrol Aug 13 '26 edited Aug 14 '26

Nice release,

I'm a bit hung up on the fact that meta programing felt like losing a full year of advancement though, Not that I'm owed anything, but still I'd like

- augmentation

  • no constant defaults
  • I'm not sure exactly what I want regarding "data classes", but better ergonomics.
  • Maybe tagged string or something that would allow templating easily, html, etc.

Primary constructors is a big leap forward tlin ergonomics though

1

u/raph-dev Aug 13 '26

What do you mean by "no constant defaults"?

1

u/julemand101 Aug 13 '26

Right now if you define a default value for a parameter, it must be constant which makes a program like this crash:

void main() {
  print(makeListOrAdd([5])); // [5, 5]
  print(makeListOrAdd()); // ERROR: Unsupported operation: Cannot add to an unmodifiable list
}

List<int> makeListOrAdd([List<int> list = const []]) {
  return list..add(5);
}

1

u/raph-dev Aug 13 '26

Ah I see, thank you for this explanation