embla_templates 0.1.5

  • README.md
  • Installing
  • Versions
  • 28

Templating for Embla

Usage with Embla

export 'package:embla/bootstrap.dart';
import 'package:embla/http.dart';

import 'package:embla_templates/embla_templates.dart';
import 'package:embla_templates/engines/html_view_engine.dart';
import 'package:embla_templates/engines/handlebars_view_engine.dart';

get embla => [
  new TemplatingBootstrapper(
    templatesDirectory: 'web',
    engines: [
  new HttpBootstrapper(
    pipeline: pipe(
      (ViewComposer view) { // Will be responding to each request

        // Given the configuration in the TemplatingBootstrapper,
        // `render` will look for `web/index.hbs` or `web/index.html`
        return view.render('index')
          ..localVariableThatWillBeAvailableInTheTemplate = "value";

Usage without Embla

import 'package:embla_templates/embla_templates.dart';
import 'package:embla_templates/engines/html_view_engine.dart';

import 'package:shelf/shelf.dart' as shelf;

main() async {
  final view = new ViewComposer.create(
    templatesDirectory: 'web',
    engines: [
      new HtmlViewEngine()

  // Turn index.html into a Template -- a Future Shelf Response
  Template template = view.render('index')
    ..localVariableThatWillBeAvailableInTheTemplate = "value";

  // Future<shelf.Response> is a valid return value in a shelf.Handler
  shelf.Response response = await template;

1. Depend on it

Add this to your package's pubspec.yaml file:

  embla_templates: "^0.1.5"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:embla_templates/embla_templates.dart';
Version Uploaded Documentation Archive
0.1.5 Sep 16, 2016 failed Download embla_templates 0.1.5 archive
0.1.4 Mar 11, 2016 Go to the documentation of embla_templates 0.1.4 Download embla_templates 0.1.4 archive
0.1.3 Mar 4, 2016 Go to the documentation of embla_templates 0.1.3 Download embla_templates 0.1.3 archive
0.1.2 Feb 24, 2016 Go to the documentation of embla_templates 0.1.2 Download embla_templates 0.1.2 archive
0.1.1 Feb 1, 2016 Go to the documentation of embla_templates 0.1.1 Download embla_templates 0.1.1 archive


We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
79 / 100
Reflects how tidy and up-to-date the package is. [more]
23 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: unsure

Error(s) prevent platform classification:

Error(s) in lib/engines/handlebars_view_engine.dart: Target of URI doesn't exist: 'package:mustache/mustache.dart'.


  • Fix platform conflicts.

    Error(s) prevent platform classification:

    Error(s) in lib/engines/handlebars_view_engine.dart: Target of URI doesn't exist: 'package:mustache/mustache.dart'.

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 5 errors 14 hints.

    Make sure that the imported libraries are not in conflict. Error(s) in lib/engines/handlebars_view_engine.dart: Target of URI doesn't exist: 'package:mustache/mustache.dart'.

    Strong-mode analysis of lib/src/view_engine.dart failed with the following error:

    line: 70 col: 3
    Invalid override. The type of 'Template.then' ('((Response) → dynamic, {onError: Function}) → Future<dynamic>') isn't a subtype of 'Future<Response>.then' ('<S>((Response) → FutureOr<S>, {onError: Function}) → Future<S>').

    Similar analysis of the following files failed:

    • lib/embla_templates.dart (hint)
    • lib/engines/chalk_view_engine.dart (hint)
    • lib/engines/html_view_engine.dart (hint)
    • lib/engines/json_view_engine.dart (hint)
    • lib/engines/txt_view_engine.dart (hint)
    • lib/src/view_composer.dart (hint)
  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use embla_templates.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0
embla ^0.2.3 0.2.3
template_cache ^0.1.1 0.1.1
Transitive dependencies
async 1.13.3 2.0.6
charcode 1.1.1
collection 1.14.9
convert 2.0.1
current_script 0.0.3
glob 1.1.5
http_parser 3.1.1
mime 0.9.6
path 1.5.1
shelf 0.6.8 0.7.2
shelf_static 0.2.7
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.5
string_scanner 1.0.2
typed_data 1.1.5
watcher 0.9.7+7
Dev dependencies
quark any
test any