dart-lang / code_builder

A fluent API for generating valid Dart source code
https://pub.dev/packages/code_builder
BSD 3-Clause "New" or "Revised" License
427 stars 66 forks source link

How to use the new added `Expression.spread` and `Expression.nullSafeSpread` api? #342

Closed rockyoung closed 1 year ago

rockyoung commented 3 years ago

I'm trying to use these two apis to build a map statement code with some key-value literals and other map references, but have no idea how to use them with literalMap?

srawlins commented 2 years ago

I don't think you can include a spread in a Map created from mapLiteral.

donny-dont commented 1 year ago

@natebosch this should be fixed now

natebosch commented 1 year ago

Fixed in https://github.com/dart-lang/code_builder/pull/400

Thanks @donny-dont !