google / built_value.dart

Immutable value types, enum classes, and serialization.
https://pub.dev/packages/built_value
BSD 3-Clause "New" or "Revised" License
864 stars 184 forks source link

Error: The method 'lookUpGetter2' isn't defined for the class 'InterfaceType' #802

Closed minikin closed 4 years ago

minikin commented 4 years ago

I've been having this error:

flutter packages pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 442ms

[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 6.2s

[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/built_value_generator-7.0.7/lib/src/fields.dart:46:14: Error: The method 'lookUpGetter2' isn't defined for the class 'InterfaceType'. - 'InterfaceType' is from 'package:analyzer/dart/element/type.dart' ('../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.2+1/lib/dart/element/type.dart').Try correcting the name to the name of an existing method, or defining a method named 'lookUpGetter2'.            .lookUpGetter2(             ^^^^^^^^^^^^^
pub finished with exit code 78

I've tried to fix corrupted cache but it didn't help.

pubspec.yaml environment: sdk: ">=2.8.0-dev <3.0.0" dependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter flutter_cupertino_localizations: ^1.0.1 auto_size_text: ^2.1.0 built_collection: ^4.3.2 built_value: ^7.0.7 cupertino_icons: ^0.1.3 device_info: ^0.4.1+4 firebase_core: ^0.4.3+2 firebase_crashlytics: ^0.1.2+4 firebase_performance: ^0.3.1+5 flutter_bloc: ^3.1.0 flutter_platform_widgets: ^0.32.2 flutter_secure_storage: ^3.3.1+1 font_awesome_flutter: ^8.5.0 http: ^0.12.0+4 path_provider: ^1.5.1 rxdart: ^0.23.1 shared_preferences: ^0.5.6 timeago: ^2.0.24 transparent_image: ^1.0.0 tuple: ^1.0.3 uuid: ^2.0.4 dev_dependencies: build_runner: ^1.7.3 built_value_generator: ^7.0.7 faker: ^1.1.1 mockito: ^4.1.1 pedantic: ^1.9.0 test: ^1.11.0 flutter: uses-material-design: true
flutter doctor -v ```sh flutter doctor -v [✓] Flutter (Channel beta, v1.13.6, on Mac OS X 10.15.2 19C57, locale en-DE) • Flutter version 1.13.6 at /Users/developer/flutter • Framework revision 659dc8129d (2 weeks ago), 2019-12-30 09:24:47 -0800 • Engine revision bdc9708d23 • Dart version 2.8.0 (build 2.8.0-dev.0.0 c547f5d933) [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at /Users/developer/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.3 • ANDROID_HOME = /Users/developer/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3.1, Build version 11C504 • CocoaPods version 1.8.4 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 42.1.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) [✓] VS Code (version 1.41.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.7.1 [✓] Connected device (2 available) • Chrome • chrome • web-javascript • Google Chrome 79.0.3945.117 • Web Server • web-server • web-javascript • Flutter Tools • No issues found! ```
davidmorgan commented 4 years ago

I think that means my dependency on analyzer is too loose, it needs a later version.

Does it work if you upgrade packages? Can you add a dependency on analyzer 0.39.3 to force it to be at least that version?

minikin commented 4 years ago

@davidmorgan I added analyzer: ^0.39.4 to dependencies and it fixed the error. Thank you for the advice!

davidmorgan commented 4 years ago

Thanks for letting me know. I'll release 7.0.8 with correct lower bound for analyzer.