render method
Renders the response by serializing data to YAML and writing it to the response.
This method first sets the content type of the response to 'application/x-yaml'
and then serializes the data to YAML format using the json2yaml package.
Finally, it writes the serialized YAML data to the response.
response is the HTTP response object where the YAML data will be written.
Implementation
@override
void render(Response response) {
// Set the content type of the response to 'application/x-yaml'.
writeContentType(response);
// Serialize the data to YAML format.
final yamlData = json2yaml(data);
// Write the serialized YAML data to the response.
response.write(yamlData);
}