view method

Response view(
  1. String filename, {
  2. Map<String, dynamic> varMap = const {},
})

Implementation

Response view(String filename, {Map<String, dynamic> varMap = const {}}) {
  var templateString = '';
  try {
    templateString = container.make('@views.$filename');
  } catch (e) {
    throw ViewNotFoundError(filename);
  }
  var template = Template(templateString);
  var output = template.renderString(varMap);
  return Response.Ok(output)..headers.contentType = ContentType.html;
}