SharedBuildStep class

A specialized build step that buffers output content to be written as a single part file.

Rather than writing each output immediately, SharedBuildStep collects all content written to it and then writes it as a single file with appropriate part directive when flush is called. This is useful for generating part files that contain multiple pieces of generated code.

Inheritance

Constructors

SharedBuildStep(Asset asset, Resolver resolver, {required Uri outputUri})
Creates a new shared build step for the given asset and resolver.

Properties

allowedExtensions → Set<String>
The set of allowed file extensions for output assets.
finalinherited
asset → Asset
The primary input for this build step.
finalinherited
generateToCache → bool
Whether to write outputs to the build cache instead of alongside inputs.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
outputs → Set<Uri>
The set of output URIs that have been written by this build step.
no setterinherited
outputUri → Uri
The URI where the final output will be written.
final
resolver → Resolver
The Resolver for this build step.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

findAssets(PathMatcher matcher, {String? subDir}) → List<Asset>
Finds assets within the root package that match the matcher pattern.
inherited
flush() → Future<void>
Writes the buffered content to the output file and clears the buffer.
getOutputUri(String extension) → Uri
Resolves the output URI for a file with the given extension.
inherited
hasValidPartDirectiveFor(String extension) → bool
Returns true if the input library has a part directive for the given extension.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
writeAsBytes(List<int> bytes, {required String extension}) → Future<void>
Writes bytes to a binary file located at id.
override
writeAsString(String contents, {required String extension, Encoding encoding = utf8}) → Future<void>
Writes contents to a text file with the specified extension using the given encoding.
override

Operators

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