renderTemplate method
Future<void>
renderTemplate(
- HttpRequest request,
- String templatePath,
- Map<
String, dynamic> context
Renders a template and sends it as a response
Implementation
Future<void> renderTemplate(HttpRequest request, String templatePath,
Map<String, dynamic> context) async {
try {
String renderedTemplate =
await _templateEngine!.render(templatePath, context);
request.response
..headers.contentType = ContentType.html
..write(renderedTemplate)
..close();
} catch (e) {
_handle500(request, e);
}
}