Skip to content

Upgrading source_gen 0.4 to 0.5

Breaking0.4.8 → 0.5.10+1Breaking3Platform1Deprecated1New7Changed15Fixed10Other5

BreakingUpgrade verdict

3 breaking changes and a platform requirement change.

  • Generators now run through a new build system, so the old top-level build and generate functions are gone.
  • This release updates the package so it works with a newer version of the analyzer library, which changed in ways that are not backward compatible.
  • Generator methods now receive an extra argument for reading and writing files.
  • You need Dart 1.22.1 or newer to use this version.
5 items need code or config changes

Dart SDK requirement changed in 0.5.9: >=1.12.0 <2.0.0 → >=1.22.1 <2.0.0.

Breaking3
Switches to the build package for running Generators, removing the top level build and generate functions.
buildgeneratewatchserveGeneratorBuilder
Upgrades source_gen to be compatible with the breaking changes in analyzer 0.28.0.
Passes a BuildStep as a second argument to Generator#generate and GeneratorForAnnotation#generateForAnnotatedElement.
BuildStepGenerator#generateGeneratorForAnnotation#generateForAnnotatedElement
Platform1
Raises the minimum Dart SDK requirement to 1.22.1.
Deprecated1
Deprecates builder.dart in favor of importing source_gen.dart.
builder.dartsource_gen.dart