Releases: dart-lang/source_gen
package:source_gen v2.0.0
- 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
, andSharedPartBuilder
now take an optional
writeDescriptions
boolean. When set tofalse
, 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
orPartBuilder
and formatted with the default callback. - Require Dart 3.6.0
package:source_gen v1.5.0
- Add
throwOnUnresolved
configuration to theGeneratorForAnnotation
constructor. - Rename
InvalidGenerationSourceError
toInvalidGenerationSource
. Change
from a subtype ofError
to a subtype ofException
. This may be breaking if
a builder relies on aon Exception catch
to ignore this error.
package:source_gen v1.4.0
- Require Dart 3.0
- Support the latest
package:analyzer
. - Add a
node
argument toInvalidGenerationSourceError
to allow finding the source location from anAstNode
over anElement
.
source_gen version 1.3.1
always use a Uri in `part of` directives (#665) Closes google/json_serializable.dart#1313
v0.9.1
0.9.1
-
The result of
ConstantReader.revive()
now returns aRevivable
that assumes
access to a private class, constructor, or function instead ofnull
where
possible. This allows generators that usepart
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 returnstrue
when the underyling class was public
but the constructor was private, or theRevivable
was pointing to a
top-level or static private field or method. Previously it was onlytrue
when referencing a private class.
0.8.2
-
Simplification to the output of generator names in header sections.
-
Update handling of whitespace in generator outputs.
- If the output from a generator has wrapping whitespace, it is trimmed.
- If the output from a generator is empty or whitespace-only, it is ignored.
- These changes will likely have no effect on output, unless you customize
the code formatter.
v0.8.1
v0.8.0
-
BREAKING removed the deprecated
requireLibraryDirective
parameter in
PartBuilder
. -
Revivable
no longer throws a type error when attempting to revive a
reference to a top-level function or static-class method. Now is returns a
reference to that function or method, as expected.
v0.7.6
0.7.6
TypeChecker
now throws anUnresolvedAnnotationException
with a more
detailed exception body (and properties useful for further debugging) instead
ofCould not resolve @null
.
v0.7.5+1
LibraryBuilder
andPartBuilder
now have a more readabletoString()
,
which is useful when emitting a warning or error in a build system. For
example you may seeGenerating .g.dart: MyBuilder
instead of
Instance of LibraryBuilder
in your build logs.