getTemplate method

Template getTemplate(
  1. String template
)

Load a template by name with loader and return a Template.

If the template does not exist a TemplateNotFound exception is thrown.

Implementation

Template getTemplate(String template) {
  if (loader case var loader?) {
    if (autoReload) {
      return templates[template] = loader.load(this, template);
    }

    return templates[template] ??= loader.load(this, template);
  }

  throw StateError('No loader for this environment specified');
}