renderFromMapFields static method

dynamic renderFromMapFields(
  1. Iterable<SerField> fields
)

Implementation

static renderFromMapFields(Iterable<SerField> fields) {
  return (LambdaContext _) => fields.map((e) {
        String deser;
        if (e.deser != null) {
          deser = e.deser!.replaceAll(SerField.ph, "map['${e.id}']");
        } else {
          deser = e.idl == 'IDL.Null'
              ? "map.containsKey('${e.id}')"
              : "map['${e.id}']";
        }
        return '${e.id!.toCamelCase()}: $deser,';
      }).join('\n');
}