buildMapperImplementation function

Method buildMapperImplementation(
  1. Map<String, List<DartObject>> config,
  2. ClassElement model
)

Generates the implemented mapper method by the given abstract MethodElement.

Implementation

Method buildMapperImplementation(Map<String, List<DartObject>> config, ClassElement model) {
  var paramBuilder = ParameterBuilder();
  paramBuilder.type = refer(model.name);
  paramBuilder.name = 'model';
  return Method((b) => b
    ..name = 'validate'
    ..returns = refer('List<ValidationError>')
    ..requiredParameters.add(paramBuilder.build())
    ..body = _generateBody(config, model)
  );
}