BuildOutput constructor

BuildOutput({
  1. DateTime? timestamp,
  2. Iterable<Asset>? assets,
  3. Iterable<Uri>? dependencies,
  4. Map<String, Object>? metadata,
})

Create a build output.

The timestamp must be before any dependencies are read by the build this output belongs to. If the BuildOutput object is created at the beginning of the build hook, timestamp can be omitted and will default to DateTime.now. The timestamp is rounded down to whole seconds, because File.lastModified is rounded to whole seconds and caching logic compares these timestamps.

The Assets produced by this build or dry-run can be provided to the constructor as assets, or can be added later using addAsset and addAssets. In dry runs, the Architecture for NativeCodeAssets can be omitted.

The files used by this build must be provided to the constructor as dependencies, or can be added later with addDependency and addDependencies. If any of these files are modified after timestamp, the build will be re-run. Typically these dependencies contain the build hook itself, and the source files used in the build.

Metadata can be passed to build hook invocations of dependent packages. It must be provided to the constructor as metadata, or added later with addMetadatum and addMetadata.

Implementation

factory BuildOutput({
  DateTime? timestamp,
  Iterable<Asset>? assets,
  Iterable<Uri>? dependencies,
  Map<String, Object>? metadata,
}) =>
    BuildOutputImpl(
      timestamp: timestamp,
      assets: assets?.cast<AssetImpl>().toList(),
      dependencies: Dependencies([...?dependencies]),
      metadata: Metadata({...?metadata}),
    );