code_builder
code_builder copied to clipboard
A fluent API for generating valid Dart source code
I have a generator that emits to the shared `.g.dart` file, but it doesn't appear to work if the source file has aliased imports. Of course, i cant add any...
Using `Allocator.simplePrefixing()` with a library decalaration resulted in bad formatted code: ```dart Library((b) => b ..docs.add( '/// My favorite library.', ) ..body.add(Field((b) => b ..name = 'test' ..modifier = FieldModifier.final$...
`LiteralMapExpression` does not yet support collection-if. This means it's not possible to generate the following: ```dart { if (x != null) 'x' : x, if (y != null) 'y': y,...
### **ISSUE CONCERNING USING `code_builder` WITH `dart_style` ON WEB** I was trying to run some dart code using the `code_builder` package and `dart_style` package in dart web for my project,...
Generated extension class doesn't have blank line between members > code to generate extension class ```dart Extension generateGoResponsiveBuildContextExtensions(List names) { return Extension( (b) => b ..name = 'GoResponsiveBuildContextExtensions' ..on =...
`Expression.asA(Expression other)` always wraps the code into parentheses. While this is a good default it is not always necessary. The problem for me is that the generated code triggers the...
We may want to switch the `orderDirectives` and `useNullSafetySyntax` defaults for DartEmitter; they both currently default to `false`. https://github.com/dart-lang/code_builder/blob/master/lib/src/emitter.dart#L78
This package was updated to use trailing commas for generated parameter and expression lists in order to address (substantial) dart format slowdowns when formatting some larger generated files. It would...
I don't have a repro for this; this comes from https://github.com/dart-lang/mockito/issues/591 where @adbonnin has a repro. Backslashes should not be used in relative import URLs. The line of code in...
Is there a way to convert a Dart code snippet into code_builder syntax? It would be significantly easier to write code_builder code if you could write a Dart example of...