build library

Classes

AssetId
Identifies an asset within a package.
AssetReader
Standard interface for reading an asset within in a package.
AssetWriter
Standard interface for writing an asset into a package's outputs.
AssetWriterSpy
An AssetWriter which tracks all assetsWritten during its lifetime.
Builder
The basic builder class, used to build new files from existing ones.
BuilderOptions
BuildStep
A single step in a build process.
FileDeletingBuilder
A PostProcessBuilder which can be configured to consume any input extensions and always deletes it primary input.
MultiPackageAssetReader
The same as an AssetReader, except that findAssets takes an optional argument package which allows you to glob any package.
MultiplexingBuilder
A Builder that runs multiple delegate builders asynchronously.
PostProcessBuilder
A builder which runs in a special phase at the end of the build.
PostProcessBuildStep
A simplified BuildStep which can only read its primary input, and can't get a Resolver or any Resources, at least for now.
ReleasableResolver
A resolver that should be manually released at the end of a build step.
Resolver
Standard interface for resolving Dart source code as part of a build.
Resolvers
A factory that returns a resolver for a given BuildStep.
Resource<T>
A handle to create and cleanup some expensive object based on a lifecycle defined by the build system.
ResourceManager
Manages fetching and disposing of a group of Resources.
StageTracker

Extensions

BuildOutputExtensions on Builder
Extensions on Builder describing expected outputs.

Properties

log → Logger
The log instance for the currently running BuildStep.
no setter

Functions

expectedOutputs(Builder builder, AssetId input) Iterable<AssetId>
Collects the expected AssetIds created by builder when given input based on the extension configuration.
runBuilder(Builder builder, Iterable<AssetId> inputs, AssetReader reader, AssetWriter writer, Resolvers? resolvers, {Logger? logger, ResourceManager? resourceManager, StageTracker stageTracker = NoOpStageTracker.instance, void reportUnusedAssetsForInput(AssetId input, Iterable<AssetId> assets)?, PackageConfig? packageConfig}) Future<void>
Run builder with each asset in inputs as the primary input.
runPostProcessBuilder(PostProcessBuilder builder, AssetId inputId, AssetReader reader, AssetWriter writer, Logger logger, {required void addAsset(AssetId), required void deleteAsset(AssetId)}) Future<void>
Run builder with inputId as the primary input.

Typedefs

BeforeExit = FutureOr<void> Function()
BuilderFactory = Builder Function(BuilderOptions options)
Creates a Builder honoring the configuation in options.
CreateInstance<T> = FutureOr<T> Function()
DisposeInstance<T> = FutureOr<void> Function(T instance)
PostProcessBuilderFactory = PostProcessBuilder Function(BuilderOptions)

Exceptions / Errors

AssetNotFoundException
BuildStepCompletedException
InvalidInputException
InvalidOutputException
NonLibraryAssetException
Thrown when attempting to read a non-Dart library in a Resolver.
PackageNotFoundException
SyntaxErrorInAssetException
Exception thrown by a resolver when attempting to resolve a Dart library with syntax errors.
UnexpectedOutputException
UnresolvableAssetException