SnippetGenerator class

Generates the snippet HTML, as well as saving the output snippet main to the output directory.

Constructors

SnippetGenerator({SnippetConfiguration? configuration, FileSystem filesystem = const LocalFileSystem(), Directory? flutterRoot})

Properties

configuration SnippetConfiguration
The configuration used to determine where to get/save data for the snippet.
final
flutterRoot → Directory
final
hashCode int
The hash code for this object.
no setterinherited
headers List<SourceLine>
Computes the headers needed for each snippet file.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

consolidateSnippets(List<CodeSample> samples, {bool addMarkers = false}) Iterable<SourceLine>
Consolidates all of the snippets and the assumptions into one snippet, in order to create a compilable result.
generateCode(CodeSample sample, {File? output, String? copyright, String? description, bool formatOutput = true, bool addSectionMarkers = false, bool includeAssumptions = false}) String
The main routine for generating code samples from the source code doc comments.
generateHtml(CodeSample sample) String
Generate the HTML using the skeleton file for the type of the given sample.
getAvailableTemplates() Iterable<File>
Returns an iterable over the template files available in the templates directory in the configuration.
getTemplatePath(String templateName, {Directory? templatesDir}) → File?
Gets the path to the template file requested.
interpolateSkeleton(CodeSample sample, String skeleton) String
Interpolates the injections into an HTML skeleton file.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseInput(CodeSample sample) List<TemplateInjection>
Parses the input for the various code and description segments, and returns a set of template injections in the order found.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

formatter ↔ DartFormatter
A Dart formatted used to format the snippet code and finished application code.
getter/setter pair

Constants

jsonEncoder → const JsonEncoder