render method

Future<void> render(
  1. String view,
  2. [Map<String, dynamic> data]
)

Renders a view to the response stream, and closes the response.

Implementation

Future<void> render(String view, [Map<String, dynamic> data]) {
  if (!isOpen) throw closed();
  contentType = MediaType('text', 'html', {'charset': 'utf-8'});
  return Future<String>.sync(() => app.viewGenerator(
      view,
      Map<String, dynamic>.from(renderParams)
        ..addAll(data ?? <String, dynamic>{}))).then((content) {
    write(content);
    return close();
  });
}