Back to directory

source_gen

source_gen is a framework and a convention for writing Dart source code generators, so multiple generators from different packages can produce code into the same project without clashing.

source_gen

source_gen provides utilities for automated source code generation in Dart. It is both a framework for writing Builders that consume and produce Dart code, and a convention that lets hand-written and generated Dart code live side by side with a clean separation, so generators from different packages can integrate in the same project.

Its main purpose is to expose a developer-friendly API on top of lower-level packages such as the analyzer and build packages, though a project can use those packages directly instead of source_gen. A generator is written by extending its Generator or GeneratorForAnnotation classes, which are then called for a Dart library, or for each annotated element within one.

source_gen builds on the build package and offers several Builder types: a SharedPartBuilder for the conventional shared part-file output that several packages can contribute to, a PartBuilder for a package's own uniquely named part files, and a LibraryBuilder for a standalone, importable generated library.

More in Libraries

See all 292
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • TradeCanvas

    bonguynvan.github.io

    A zero-dependency canvas charting engine for building TradingView-style trading charts in JavaScript, with 66 technical indicators, 24 drawing tools, 17 chart types, and real-time streaming.

  • 3d retro graphics

    3d-retro.com

    A free, CC0-licensed library of copy-paste retro 3D and demoscene graphics effects, such as plasma, raytracing, and voxel terrain, runnable as WebGL 1 or plain 2D canvas.