Skip to content
pubscout

merging_builder

1.1.2, released 2 weeks ago by simphotonics.com

Merges multiple input files into a single output file during the build process.

$ flutter pub add merging_builder
Source repository

What it does

The package provides a builder that reads several source files and writes a single merged file. It supports optional topological sorting of inputs and custom output paths.

AI-written summary of version 1.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to combine generated code from multiple files into one file
  • You want to control the order of merged assets
  • You are already using build_runner and source_gen for code generation

Skip it when

  • You only need to generate a single file
  • You prefer a simpler, non‑stream based approach

Strengths

  • Integrates with build_runner and source_gen
  • Supports topological sorting to avoid dependency cycles
  • Customizable input/output via build.yaml
  • No runtime overhead – all work happens at build time

Weaknesses

  • Only works with Dart build system
  • Requires build_runner configuration
  • Limited to merging – not suitable for other code generation patterns

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
10

Add merging_builder to dependencies, configure build.yaml with build_extensions and options, run `dart run build_runner build`

```dart
// build.yaml
builders:
  merging_builder:
    import: "package:merging_builder/merging_builder.dart"
    builder_factories: ["mergingBuilder"]
    build_extensions: {"lib/$lib$": ["lib/merged.dart"]}
    auto_apply: root_package
    build_to: source
```

Alternatives

Packages that do the same job and could replace merging_builder.

Works with

Packages commonly used together with merging_builder: ones it builds on, ones built on it, and its own family.