Line data Source code
1 : import 'package:build/build.dart'; 2 : import 'package:source_gen/source_gen.dart'; 3 : 4 : import 'package:class_fields/domain/settings.dart'; 5 : import 'package:class_fields/src/generator.dart'; 6 : 7 : /// Not meant to be invoked by hand-authored code. 8 1 : Builder fieldsBuilder(BuilderOptions options) { 9 2 : final settings = Settings.fromConfig(options.config); 10 : 11 0 : Formatter? formatter = (s) => s; 12 : 13 1 : if (settings.formatOuput) { 14 : formatter = null; 15 : } 16 : 17 1 : return SharedPartBuilder( 18 1 : [const FieldsGenerator()], 19 : 'class_fields', 20 : formatOutput: formatter, 21 : ); 22 : } 23 : 24 : /// The formatter for the generated code. 25 : typedef Formatter = String Function(String);