clazzTpl top-level constant

String const clazzTpl

Implementation

const clazzTpl = '''
{{# renderClassComment }}{{/ renderClassComment }}
class {{ clazz }} {
  const {{ clazz }}(
    {{# renderConstructorFields }}{{/ renderConstructorFields }}
  );

  factory {{ clazz }}.fromJson(Map<dynamic, dynamic> map,) {
    return {{ clazz }}(
     {{# renderFromMapFields }}{{/ renderFromMapFields }}
    );
  }

  {{# renderFields }}{{/ renderFields }}

  {{# renderIDL }}{{/ renderIDL }}

  Map<String, dynamic> toJson() {
    return <String, dynamic>{
      {{# renderToJsonFields }}{{/ renderToJsonFields }}
    }
    ..removeWhere((String key, dynamic value){
      return value == null{{#variant}}|| value == false{{/variant}};
    })
    {{#variant}}
      ..updateAll((String key, dynamic value) {
        return value is bool ? null : value;
      })
    {{/variant}}
    ;
  }

  {{# renderCopy }}{{/ renderCopy }}

  {{# renderToString }}{{/ renderToString }}
  {{# renderEquals }}{{/ renderEquals }}
  {{# renderHashCode }}{{/ renderHashCode }}
}
''';