Line data Source code
1 : import 'package:meta/meta.dart'; 2 : 3 : /// {@template settings} 4 : /// The configuration from the build.yaml file 5 : /// {@endtemplate} 6 : class Settings { 7 : /// {@macro settings} 8 2 : const Settings({ 9 : required this.formatOuput, 10 : }); 11 : 12 : /// constructs a [Settings] from the build.yaml file 13 1 : factory Settings.fromConfig(Map<String, dynamic> json) { 14 1 : return Settings( 15 1 : formatOuput: json['format_output'] as bool? ?? false, 16 : ); 17 : } 18 : 19 : /// Whether to format the output of the generated code. 20 : final bool formatOuput; 21 : 22 : /// sets formatOutput to true 23 1 : @visibleForTesting 24 : static Map<String, dynamic> debug() { 25 1 : return const Settings(formatOuput: true)._toJson(); 26 : } 27 : 28 1 : Map<String, dynamic> _toJson() { 29 1 : return <String, dynamic>{ 30 1 : 'format_output': formatOuput, 31 : }; 32 : } 33 : }