renderConstructorFields static method

dynamic renderConstructorFields(
  1. Iterable<SerField> fields
)

Implementation

static renderConstructorFields(Iterable<SerField> fields) {
  if (fields.isEmpty) return '';
  return (LambdaContext _) => "{${fields.map((e) {
        if (e.type == 'bool' && e.idl == 'IDL.Null') {
          return "this.${e.id!.toCamelCase()} = false,";
        }
        return "${e.nullable ? '' : 'required'} this.${e.id!.toCamelCase()},";
      }).join("\n")}}";
}