buildStepForTestContent function

  1. @visibleForTesting
InMemoryBuildStep buildStepForTestContent(
  1. String content, {
  2. Set<String> allowedExtensions = const {'g.dart'},
  3. Set<String> includePackages = const {},
})

Creates an in-memory InMemoryBuildStep from a raw string content.

This is a convenience wrapper around buildStepForTestAsset that constructs a StringAsset from content. The returned build step records outputs in memory instead of writing to disk which makes it suitable for tests.

Implementation

@visibleForTesting
/// Creates an in-memory [InMemoryBuildStep] from a raw string [content].
///
/// This is a convenience wrapper around [buildStepForTestAsset] that constructs a
/// [StringAsset] from [content]. The returned build step records outputs in
/// memory instead of writing to disk which makes it suitable for tests.
InMemoryBuildStep buildStepForTestContent(
  String content, {
  Set<String> allowedExtensions = const {'g.dart'},
  Set<String> includePackages = const {},
}) {
  return buildStepForTestAsset(
    StringAsset(content),
    allowedExtensions: allowedExtensions,
    includePackages: includePackages,
  );
}