Line data Source code
1 : // ignore_for_file: comment_references 2 : import 'package:enum_assist/src/enum_field.dart'; 3 : import 'package:enum_assist/src/templates/extension_template.dart'; 4 : import 'package:enum_assist_annotation/enum_assist_annotation.dart'; 5 : 6 : /// {@template enum_assist.additional_map_template} 7 : /// helper class to create [MapTemplate]s or [MaybeMapTemplate]s 8 : /// 9 : /// Uses the [map] method to access the enum value 10 : /// {@endtemplate} 11 : class AdaptiveTemplate extends ExtensionTemplate { 12 : /// {@macro enum_assist.additional_map_template} 13 0 : AdaptiveTemplate( 14 : String enumName, 15 : Iterable<EnumField> fields, { 16 : required String methodName, 17 : required String? Function(EnumField) getValue, 18 : required String? defaultValue, 19 : required String typeAsString, 20 : required MethodType methodType, 21 : required String docComment, 22 0 : }) : super( 23 : enumName, 24 : fields, 25 : methodName: methodName, 26 : defaultValue: defaultValue, 27 : returnValue: getValue, 28 : methodType: methodType, 29 : typeAsString: typeAsString, 30 : docComment: docComment, 31 : ); 32 : }