build_test library Null safety


A fake DirectoryWatcher. [...]
A simple builder which globs files in a package and outputs a file that lists each matching file in alphabetical order into another file, one per line.
An implementation of AssetReader with primed in-memory assets.
An implementation of AssetWriter that writes outputs to memory.
A MultiPackageAssetReader that delegates to multiple other asset readers. [...]
Resolves using a PackageConfig before reading from the file system. [...]
An AssetReader that records which assets have been read to assetsRead.
An implementation of AssetWriter that records outputs to assets.
A no-op implementation of AssetReader.
A no-op implementation of AssetWriter.
A Builder whose build method can be replaced with a closure.
A MultiPackageAssetReader which supports reads from previous outputs.


useAssetReader → const String
Marker constant that may be used in combination with resolveSources. [...]


assetNotFoundException TypeMatcher<AssetNotFoundException>
Matches instance of AssetNotFoundException.
invalidInputException TypeMatcher<InvalidInputException>
Matches instance of InvalidInputException.
invalidOutputException TypeMatcher<InvalidOutputException>
Matches instance of InvalidOutputException.
packageNotFoundException TypeMatcher<PackageNotFoundException>
Matches instance of PackageNotFoundException.


addAssets(Map<AssetId, dynamic> assets, InMemoryAssetWriter writer) → void
anyLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of any level whose message is messageOrMatcher. [...]
appendExtension(String postFix, {String from = '', int numCopies = 1}) Map<String, List<String>>
A Builder.buildExtensions which operats on assets ending in from and creates outputs with postFix appended as the extension. [...]
checkOutputs(Map<String, Object>? outputs, Iterable<AssetId> actualAssets, RecordingAssetWriter writer, {AssetId mapAssetIds(AssetId id) = _passThrough}) → void
Validates that actualAssets matches the expected outputs. [...]
copyFrom(AssetId assetId) BuildBehavior
A build behavior which reads assetId and copies it's content into every output.
decodedMatches(dynamic expected, {Encoding? encoding}) TypeMatcher<List<int>>
Decodes the value using encoding and matches it against expected.
infoLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.INFO where message is messageOrMatcher.
makeAssetId([String? assetIdString]) AssetId
recordLogs(dynamic run(), {String name = ''}) Stream<LogRecord>
Executes run with a new Logger, returning the resulting log records. [...]
replaceExtension(String from, String to) Map<String, List<String>>
resolveAsset<T>(AssetId inputId, FutureOr<T> action(Resolver resolver), {PackageConfig? packageConfig, Future<void>? tearDown, Resolvers? resolvers}) Future<T>
A convenience for using resolveSources with a single inputId from disk.
resolveSource<T>(String inputSource, FutureOr<T> action(Resolver resolver), {AssetId? inputId, PackageConfig? packageConfig, Future<void>? tearDown, Resolvers? resolvers}) Future<T>
A convenience method for using resolveSources with a single source file.
resolveSources<T>(Map<String, String> inputs, FutureOr<T> action(Resolver resolver), {PackageConfig? packageConfig, String? resolverFor, String? rootPackage, Future<void>? tearDown, Resolvers? resolvers}) Future<T>
Resolves and runs action using a created resolver for inputs. [...]
scopeLogAsync<T>(Future<T> fn(), Logger log) Future<T>
Runs fn in an error handling Zone. [...]
severeLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.SEVERE where message is messageOrMatcher.
testBuilder(Builder builder, Map<String, Object> sourceAssets, {Set<String>? generateFor, bool isInput(String assetId)?, String? rootPackage, MultiPackageAssetReader? reader, RecordingAssetWriter? writer, Map<String, Object>? outputs, void onLog(LogRecord log)?, void reportUnusedAssetsForInput(AssetId, Iterable<AssetId>)?, PackageConfig? packageConfig}) Future
Runs builder in a test environment. [...]
warningLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.WARNING where message is messageOrMatcher.
writeCanRead(AssetId assetId) BuildBehavior
A build behavior which writes either 'true' or 'false' depending on whether assetId can be read.


BuildBehavior = FutureOr Function(BuildStep buildStep, Map<String, List<String>> buildExtensions)
Overridable behavior for a method.