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