TemplateRenderer class abstract final

Fills a template's placeholders for one project.

A placeholder is a key in double braces. The names every project has come from ProjectNames: {{name}} (the package name), {{App}} (the app widget's class), and the title — {{title}} as it is (for comments and Markdown), or escaped for where it goes: {{title.dart}} in a Dart string quoted with ', {{title.yaml}} in a YAML string quoted with ", {{title.json}}, {{title.xml}} and {{title.c}} (a C/C++ string). A product adds its own values, and lists of lines (a pubspec's dependencies), each written as lines of their own.

Each placeholder is filled once: what is filled in is never read as a placeholder. One nobody gave a value for is left as it is.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

dependencyLines(SetPackage package, {bool hosted = false}) → List<String>
The pubspec lines for package: a constraint, a git source, or a constraint resolved through a path override (hosted, for linked checkouts). Each value is written as PubspecEditor.scalar writes it — quoted when YAML would read it otherwise (>=1.0.0 <2.0.0, a URL with a #) — so it reads back as the same string.
namesOf(ProjectNames names) → Map<String, String>
The values every project has, by placeholder: its names and its title, escaped for each kind of file.
render(Map<String, String> files, {required ProjectNames names, Map<String, String> values = const {}, Map<String, List<String>> lines = const {}}) → Map<String, String>
files (path → text) with their placeholders filled for names, plus values and lines. A placeholder in lines is replaced, with the line break after it, by its lines, each ending in a line break (nothing at all for none). Throws ArgumentError for a title with a ProjectNames.titleProblem.