PackageTrack
Sign in Get early access

source_gen

Source code generation builders and utilities for the Dart build system

4.3.0 5.7M downloads/mo #134 most downloaded on pub.dev dart-lang/source_gen

What this package is like to depend on

Last release 4 days ago

19 Aug 2026

Release timing varies

gaps range from 2 weeks to 6 months

Nearly every release is documented

notes for 142 of 143 stable releases

Nothing withdrawn

no release was ever pulled

12 years old

146 releases · first in 2015

11 releases in the last 12 months

see the full history below

Release timeline

146 releases · Jan 2015 to Aug 2026
2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 60 of 146
  1. 4.3.0 19 Aug 2026
    Release notes
    • Support Dart 3.13 primary constructors and new constructor syntax in
      TypeChecker and ConstantReader.
    • Require sdk: ^3.11.0.
    • Require analyzer: '>=14.0.0 <15.0.0'.
    Open source →
    Release notes
    • Support Dart 3.13 primary constructors and new constructor syntax in TypeChecker and ConstantReader.
    • Require sdk: ^3.11.0.
    • Require analyzer: '>=14.0.0 <15.0.0'.
    Open source →
  2. 4.2.4 23 Jul 2026
    Release notes
    • Require analyzer: '>=8.1.1 <15.0.0'
    Open source →
    Release notes
    • Require analyzer: '>=8.1.1 <15.0.0'
    Open source →
  3. 4.2.3 29 Apr 2026
    Release notes
    • Require analyzer: '>=8.1.1 <14.0.0'
    Open source →
    Release notes
    • Require analyzer: '>=8.1.1 <14.0.0'
    Open source →
  4. 4.2.2 20 Mar 2026
    Release notes
    • Require analyzer: '>=8.1.1 <13.0.0'
    Open source →
    Release notes
    • Require analyzer: '>=8.1.1 <13.0.0'
    Open source →
  5. 4.2.1 13 Mar 2026
    Release notes
    • Fix UnresolvedAnnotationException to include the name of the annotation in
      the message.
    • Require build: '>=3.0.2 <5.0.0'
    • Require dart_style: ^3.1.2
    • Require sdk: ^3.9.0
    Open source →
    Release notes
    • Fix UnresolvedAnnotationException to include the name of the annotation in the message.
    • Require build: '>=3.0.2 <5.0.0'
    • Require dart_style: ^3.1.2
    • Require sdk: ^3.9.0
    Open source →
  6. 4.2.0 20 Jan 2026
    Release notes
    • Add header configuration to CombiningBuilder.
    Open source →
    Release notes
    • Add header configuration to CombiningBuilder.
    Open source →
  7. 4.1.2 13 Jan 2026
    Release notes
    • Allow analyzer: '>=8.1.1 <11.0.0'.
    Open source →
    Release notes
    • Allow analyzer: '>=8.1.1 <11.0.0'.
    Open source →
  8. 4.1.1 19 Nov 2025
    Release notes
    • Allow analyzer: '>=8.1.1 <10.0.0'.
    Open source →
    Release notes
    • Allow analyzer: '>=8.1.1 <10.0.0'.
    Open source →
  9. 4.1.0 18 Nov 2025
    Release notes
    • Add TypeChecker.typeNamedLiterally. It's like TypeChecker.typeNamed,
      but takes a String instead of a Type.
    Open source →
    Release notes
    • Add TypeChecker.typeNamedLiterally. It's like TypeChecker.typeNamed, but takes a String instead of a Type.
    Open source →
  10. 4.0.2 09 Oct 2025
    Release notes
    • Bug fix: fix possible null pointer exception in TypeChecker.typeNamed on
      invalid code.
    Open source →
    Release notes
    • Bug fix: fix possible null pointer exception in TypeChecker.typeNamed on invalid code.
    Open source →
  11. 4.0.1 04 Sep 2025
    Release notes
    • Require analyzer: '>=8.1.1 <9.0.0'.
    • Allow build: '>=3.0.0 <5.0.0'.
    Open source →
  12. 4.0.0 27 Aug 2025
    Release notes
    • Breaking Change: remove TypeChecker.fromRuntime, use TypeChecker.typeNamed instead. This removes all use of dart:mirror, so builders using source_gen can be AOT compiled for better performance.
    • Keep // GENERATED FILE comments on the first line.
    Open source →
  13. 3.1.0 11 Aug 2025
    Release notes
    • Prepare to stop using dart:mirrors: deprecate TypeChecker.fromRuntime. It will be removed in version 4.0.0. Add TypeChecker.typeNamed which is the recommended replacement.
    • Prepare to stop using dart:mirrors: add inPackage and inSdk parameters to GenerateForAnnotation. These will start being used in version 4.0.0 when it switches to TypeChecker.typeNamed.
    • InvalidGenerationSource support for Fragment, ElementDirective and Annotatable.
    • Allow analyzer: '>=7.4.0 <9.0.0'.
    Open source →
  14. 3.0.0 17 Jul 2025
    Release notes
    • Breaking Change: use the new element2 APIs in analyzer. Builders that do resolution need to switch to the new API, see https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/doc/element_model_migration_guide.md. For questions please use https://github.com/dart-lang/build/discussions.
    • Breaking Change: annotations are now reported separately for elements and directives. If you use TypeChecker().annotatedWith(), see also the new TypeChecker().libraryDirectivesAnnotatedWith(). If you use GeneratorForAnnotation see the new generateForAnnotatedDirective.
    • Require build: ^3.0.0
    • Updated the minimum package versions for a number of dependencies.
    • Require Dart 3.7.0
    • Update the GeneratorForAnnotation optimization to skip files with well known annotation names such as override, Deprecated, and pragma.
    Open source →
  15. 3.0.0-dev 27 Jun 2025 pre-release
    Release notes
    • Breaking Change: use the new element2 APIs in analyzer. Builders that do resolution need to switch to the new API, see https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/doc/element_model_migration_guide.md. For questions please use https://github.com/dart-lang/build/discussions.
    • Updated the minimum package versions for a number of dependencies.
    • Require Dart 3.7.0
    Open source →
  16. 2.0.0 17 Dec 2024
    Release notes
    • Breaking Change: Change formatOutput function to accept a language version parameter.
    • Formatting Change: Generated code will no longer apply any fixes by default (previously it would apply the single cascades statements fix). The new formatter does not support applying fixes.
    • Document deduplication behavior for the output of GeneratorForAnnotation.generateForAnnotatedElement.
    • Support all the glob quotes.
    • Require analyzer: '>=6.9.0 <8.0.0'
    • Support the latest package:dart_style
    • LibraryBuilder, PartBuilder, and SharedPartBuilder now take an optional writeDescriptions boolean. When set to false, headers and generator descriptions for the files will not be included in the builder output.
    • Include //dart format width=80 comments in files generated by a LibraryBuilder or PartBuilder and formatted with the default callback.
    • Require Dart 3.6.0
    Open source →
  17. 1.5.0 13 Dec 2023
    Release notes
    • Add throwOnUnresolved configuration to the GeneratorForAnnotation constructor.
    • Rename InvalidGenerationSourceError to InvalidGenerationSource. Change from a subtype of Error to a subtype of Exception. This may be breaking if a builder relies on a on Exception catch to ignore this error.
    Open source →
  18. 1.4.0 29 Jun 2023
    Release notes
    • Require Dart 3.0
    • Support the latest package:analyzer.
    • Add a node argument to InvalidGenerationSourceError to allow finding the source location from an AstNode over an Element.
    Open source →
  19. 1.3.2 11 May 2023
    Release notes
    • Make TypeChecker.isAssignableFromType() null safe.
    Open source →
  20. 1.3.1 09 May 2023
    Release notes
    • Always use a Uri in part of directives (previously a name would be used if the library had a non-empty one).
    Open source →
  21. 1.3.0 05 May 2023
    Release notes
    • Add support for build_extensions configuration of builders producing multiple files. For example: build_extensions: { '.dart': ['.stub.dart', '.web.dart', '.vm.dart'] }
    • Avoid throwing when a type without a backing class is checked with TypeChecker.
    • Include imports, exports, and part directives in LibraryReader.allElements. This allows GeneratorForAnnotation to target annotated directives.
    Open source →
  22. 1.2.7 31 Jan 2023
    Release notes
    • Update the value of the pubspec repository field.
    • Require Dart SDK version 2.18.
    • Fix type-checking mixin elements with TypeChecker.
    Open source →
  23. 1.2.6 11 Oct 2022
    Release notes
    • Add support for a preamble option to combining_builder.
    Open source →
  24. 1.2.5 20 Sep 2022
    Release notes
    • Fix another issue with overly specific types.
    Open source →
  25. 1.2.4 20 Sep 2022
    Release notes
    • Fix overly-specific cast.
    Open source →
  26. 1.2.3 13 Sep 2022
    Release notes
    • Require analyzer: '>=4.6.0 <6.0.0'
    • Require sdk: '>=2.17.0 <3.0.0'
    Open source →
  27. 1.2.2 14 Apr 2022
    Release notes
    • Enable the fix for single cascade statements when formatting Dart code.
      • Individual builders can opt out of this by providing a custom formatOutput function to the PartBuilder or LibraryBuilder constructors.
    • Allow analyzer version 4.x.
    Open source →
  28. 1.2.1 16 Dec 2021
    Release notes
    • Allow reviving constants which are static fields defined on the class which represents their type. Previously we checked this pattern only for enums, however there are enum-like usages in classes which are not enums.
    • Allow the latest version of package:analyzer.
    Open source →
  29. 1.2.0 29 Nov 2021
    Release notes
    • Include the LibraryElement in LibraryReader.allElements, LibraryReader.annotatedWith, and LibraryReader.annotatedWithExact. Run GeneratorForAnnotation generators on library elements when the library statement has the annotation.
    • Add support for build_extensions configuration to the PartBuilder and LibraryBuilder. You must forward the BuilderOptions object to the super constructor for this to work.
    • Fix a bug finding source locations for reporting unresolved annotations on parameters.
    • Fix a bug checking for part statements on Windows.
    Open source →
  30. 1.1.1 27 Sep 2021
    Release notes
    • Drop dependency on package:pedantic.
    Open source →
  31. 1.1.0 19 Aug 2021
    Release notes
    • Add the build_extensions option to combining_builder, allowing output files to be generated into a different directory.
    Open source →
  32. 1.0.5 21 Jul 2021
    Release notes
    • Fix a bug with reviving constant expressions which are fields defined on a different class than their type (but in the same library).
    Open source →
  33. 1.0.4 19 Jul 2021
    Release notes
    • Fix warnings with latest analyzer, require analyzer 2.x.
    Open source →
  34. 1.0.3 13 Jul 2021
    Release notes
    • Allow the latest version of package:analyzer.
    Open source →
  35. 1.0.2 10 Jun 2021
    Release notes
    • Fix TypeChecker.fromRuntimeType for types that come from non-package uris.
    Open source →
  36. 1.0.1 26 May 2021
    Release notes
    • Improve the error message for a missing part directive.
    • Upgrade to package:analyzer version 1.7.0.
    Open source →
  37. 1.0.0 18 Mar 2021
    Release notes
    • Migrate to null safety.
    • Drop deprecated APIs:
      • ConstantReader.isAny.
      • ConstantReader.anyValue.
      • LibraryReader.classElements.
    Open source →
  38. 0.9.10 08 Dec 2020
    Release notes
    • Optimize for the case where we have only GeneratorForAnnotation generators, and we know there are no annotations present in the file at all.
    Open source →
  39. 0.9.10+1 14 Dec 2020
    Release notes
    • Fix a bug in the early bailout optimization where it wouldn't check for annotations in part files.
    Open source →
  40. 0.9.10+2 10 Feb 2021
    Release notes
    • Expand allowed versions for the glob package as source_gen is compatible to break circular dependency issues in the ecosystem.
    Open source →
  41. 0.9.10+3 18 Feb 2021
    Release notes
    • Allow the latest version of package:analyzer.
    Open source →
  42. 0.9.10+4 15 Mar 2021
    Release notes
    • Upgrade to package:build version 2.0.0.
    • Handle alias types with DartType.aliasElement.
    Open source →
  43. 0.9.10+5 05 Jan 2022
    Release notes
    • Widen dart_style range to include v2.x.
    Open source →
  44. 0.9.9 02 Dec 2020
    Release notes
    • Allow package:analyzer version 0.41.x.
    Open source →
  45. 0.9.8 27 Oct 2020
    Release notes
    • Add support for allowSyntaxErrors flag introduced in package:build version 1.4.0.
    • Update minimum Dart SDK to 2.10.0.
    Open source →
  46. 0.9.7+1 22 Sep 2020
    Release notes
    • Allow package:analyzer version 0.40.x.
    Open source →
  47. 0.9.6 10 Jul 2020
    Release notes
    • Add support for Set in ConstantReader.
      • Updated isLiteral and literalValue to handle Set.
      • Added isSet and setValue members.
    • Include matching Dart language version overrides in generated parts if the source library has a language version override.
    • Streamlined error handling in all builders. There should be no user-visible behavior change.
    • Improve the error message when source code formatting fails.
    • Update minimum Dart SDK to 2.7.0.
    • Changed the behavior of LibraryReader.allElements to include extensions.
    Open source →
  48. 0.9.5 24 Feb 2020
    Release notes
    • Add support for an ignore_for_file option to combining_builder.

    • Expand documentation for GeneratorForAnnotation to make it clear that it only targets elements at the top level of a library.

    Open source →
  49. 0.9.4 15 Jan 2019
    Release notes
    • Use ParsedLibraryResult to find source spans for unresolvable annotations.
    Open source →
  50. 0.9.4+1 01 Feb 2019
    Release notes
    • Support the latest pkg:analyzer.
    Open source →
  51. 0.9.4+2 03 Apr 2019
    Release notes
    • Allow pkg:analyzer version 0.36.x.
    Open source →
  52. 0.9.4+3 20 Jul 2019
    Release notes
    • Allow pkg:analyzer version 0.37.x.
    Open source →
  53. 0.9.4+4 21 Aug 2019
    Release notes
    • Allow pkg:analyzer version 0.38.x.
    Open source →
  54. 0.9.4+5 26 Sep 2019
    Release notes
    • Fix a bug for finding the element for a function with recent versions of analyzer.
    Open source →
  55. 0.9.4+6 29 Oct 2019
    Release notes
    • Allow package:analyzer version 0.39.x.
    Open source →
  56. 0.9.4+7 02 Jan 2020
    Release notes
    • Fix an exception during error reporting when the Element reported is in a summary file rather than a source file.
    Open source →
  57. 0.9.3 12 Dec 2018
    Release notes
    • Rename LibraryReader.classElements to LibraryReader.classes to better reflect the behavior. Deprecate the old name.
    • Add LibraryReader.enums.
    Open source →
  58. 0.9.2 06 Dec 2018
    Release notes
    • Avoid using the AST analyzer model from LibraryReader.
    • Don't create part files with no corresponding library.
    • Update analyzer constraint to allow 0.34.x.
    Open source →
  59. 0.9.1 10 Sep 2018
    Release notes
    • The result of ConstantReader.revive() now returns a Revivable that assumes access to a private class, constructor, or function instead of null where possible. This allows generators that use part files to still use this functionality and allows generators that use separate libraries to emit more actionable error messages (i.e. "cannot use private class _X").

    • Revivable.isPrivate now returns true when the underlying class was public but the constructor was private, or the Revivable was pointing to a top-level or static private field or method. Previously it was only true when referencing a private class.

    Open source →
  60. 0.9.1+1 25 Sep 2018
    Release notes
    • Allow package:build version 1.0.0.
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive