Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding dependency results in error #6

Closed
passsy opened this issue Feb 9, 2020 · 2 comments
Closed

Adding dependency results in error #6

passsy opened this issue Feb 9, 2020 · 2 comments

Comments

@passsy
Copy link
Sponsor

passsy commented Feb 9, 2020

I have not even added any union code to my pure dart project and build_runner results in following error:

$ pub run build_runner watch
[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
[SEVERE] ../../../../.pub-cache/hosted/pub.dartlang.org/freezed-0.1.0/lib/src/generator.dart:97:99: Error: The method 'getDisplayString' isn't defined for the class 'DartType'. - 'DartType' is from 'package:analyzer/dart/element/type.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.0/lib/dart/element/type.dart').Try correcting the name to the name of an existing method, or defining a method named 'getDisplayString'.        for (final property in commonProperties) Getter(name: property.name, type: property.type?.getDisplayString()),                                                                                                  ^^^^^^^^^^^^^^^^../../../../.pub-cache/hosted/pub.dartlang.org/freezed-0.1.0/lib/src/generator.dart:121:64: Error: The method 'getDisplayString' isn't defined for the class 'DartType'. - 'DartType' is from 'package:analyzer/dart/element/type.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.0/lib/dart/element/type.dart').Try correcting the name to the name of an existing method, or defining a method named 'getDisplayString'.            Property(name: property.name, type: property.type?.getDisplayString())                                                               ^^^^^^^^^^^^^^^^../../../../.pub-cache/hosted/pub.dartlang.org/freezed-0.1.0/lib/src/generator.dart:124:55: Error: The method 'getDisplayString' isn't defined for the class 'DartType'. - 'DartType' is from 'package:analyzer/dart/element/type.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.0/lib/dart/element/type.dart').Try correcting the name to the name of an existing method, or defining a method named 'getDisplayString'.          return Property(name: p.name, type: p.type?.getDisplayString());                                                      ^^^^^^^^^^^^^^^^../../../../.pub-cache/hosted/pub.dartlang.org/freezed-0.1.0/lib/src/templates/parameter_template.dart:43:25: Error: The method 'getDisplayString' isn't defined for the class 'DartType'. - 'DartType' is from 'package:analyzer/dart/element/type.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.0/lib/dart/element/type.dart').Try correcting the name to the name of an existing method, or defining a method named 'getDisplayString'.          type: e.type?.getDisplayString(),                        ^^^^^^^^^^^^^^^^../../../../.pub-cache/hosted/pub.dartlang.org/freezed-0.1.0/lib/src/templates/parameter_template.dart:51:23: Error: The method 'getDisplayString' isn't defined for the class 'DartType'. - 'DartType' is from 'package:analyzer/dart/element/type.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.0/lib/dart/element/type.dart').Try correcting the name to the name of an existing method, or defining a method named 'getDisplayString'.        type: e.type?.getDisplayString(),                      ^^^^^^^^^^^^^^^^

Same happens when I add freezed union code.

Pub 2.7.0
analyzer 0.39.0
build_runner 1.7.4
freezed 0.1.0
source_gen 0.9.4+7
@passsy
Copy link
Sponsor Author

passsy commented Feb 9, 2020

Upgrading to analyzer 0.39.4 solves the issue. You should upgrade the dependency range

analyzer: ^0.39.0

@rrousselGit
Copy link
Owner

Done.
It sounds like it was added in 0.39.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants