A package with a bunch of classes, helpers, generators and things to work with package:build with ease


Abstract classes of builders that contains a function to override that should return the output of the file given by parameter:


A Builder with Multiple Input, Single Output strategy that produces its output through calling the following function:

FutureOr<String> buildOutput(Set<AssetId> inputs);

In there you should process the inputs for obtaining the Single Output which contents will be returned by the function.


A Builder with Multiple Input, Multiple Output strategy that produces its Multiple Outputs by calling the following function once per output provided

FutureOr<String> buildOutputFor(String outputPath, Set<AssetId> inputs);

where outputPath will contain the path of the file being generated in the call to the function and inputs will be the same as with MISO builders

Analyzer builders

As an extension for the above mentioned builders, the Analyzer Builders include in their functions a second one for performing the analysis of the code with the analyzer package. The function to implement is this:

FutureOr<Map> analysisResultsFor(
      AssetId asset, LibraryElement library, Resolver resolver);

In there you should generate a map containing the data you need from the analysis done of the asset provided with the library and resolver derived of it. It will be used later in the respective function for building.


The analyzer equivalent of the MISOBuilder which function is the following:

FutureOr<String> buildOutputWithAnalysis(Map<AssetId, Map> inputsWithAnalysis);

In there you should process the inputWithAnalysis (a map with the input assets matched with their respective previously analyzed) for obtaining the Single Output which contents will be the returned by the function.


This is the same as with the above builder except that the function will be called once for every output, which path will be provided by parameter.

FutureOr<String> buildOutputWithAnalysisFor(
      String outputPath, Map<AssetId, Map> inputsWithAnalysis);


This package also provides helpers for the source_gen package


It's an abstract class that should be instantiated with a fuction for checking if the part file should be generated or not. That function should follow this type:

typedef ShouldGenerateForFuction = bool Function(ClassElement element);

In case it returns true the implementation of the following function will be run:

FutureOr<String> partCode(ClassElement element);

and the output will be the source of the part file generated.

As an example, a part generator that finds private classes and creates a part file of them with the comment of the class found should be like this:

class ExampleClassPartGenerator extends ClassPartGenerator {
  ExampleClassPartGenerator(ShouldGenerateForFuction checkingFn)
      : super(checkingFunction: checkingFn);

  FutureOr<String> partCode(ClassElement element) {
    return '//Found class: ${}';

// The file of this function may/should be referenced by build.yaml 
Builder exampleBuilder() {
  ShouldGenerateForFunction fn;
  fn = (e) => e.isPrivate;
  return PartBuilder([ExampleClassPartGenerator(fn)], '.g.dart');


A library with common builders to use them with ease
Testing utilities for working with builders and so