renderComponent function

Future<ResponseLike> renderComponent(
  1. Component app, {
  2. Request? request,
  3. bool standalone = false,
})

Directly renders the provided component to HTML. Returns a ResponseLike object.

  • Accepts a request object for getting the current url and headers.
  • When standalone is false (default), the html output will have a full document structure (html, head, body).

Implementation

Future<ResponseLike> renderComponent(Component app, {Request? request, bool standalone = false}) async {
  _checkInitialized('renderComponent');
  request ??= Request('GET', Uri.parse('https://0.0.0.0/'));
  var fileLoader = proxyFileLoader(request, staticFileHandler());
  return render(_createSetup(app), request, fileLoader, standalone);
}