Environment
- Flutter: 3.44.0 (channel stable)
- Dart SDK: 3.12.0
- OS: Ubuntu 24.04 (WSL2)
Steps to Reproduce
git clone https://github.com/MostroP2P/mobile.git
cd mobile
flutter pub get
dart run build_runner build -d
Error
W source_gen-3.1.0/lib/src/constants/revive.dart:82:40: Error: The method
'getInvocation' isn't defined for the type 'DartObjectImpl'.
- 'DartObjectImpl' is from 'package:analyzer/src/dart/constant/value.dart'
Try correcting the name to the name of an existing method, or defining a
method named 'getInvocation'.
final i = (object as DartObjectImpl).getInvocation();
^^^^^^^^^^^^^
E Failed to compile build script.
Root Cause
build_runner: ^2.4.0 resolves to build_runner 2.7.1 which pulls source_gen 3.1.0. That version calls DartObjectImpl.getInvocation() which was removed in analyzer 8.x. Flutter 3.44.0 ships Dart 3.12.0 which forces analyzer 8.4.1.
source_gen 3.2.0 does not exist on pub.dev, there is no released version of source_gen that supports analyzer >=8.0.0. Bumping build_runner or mockito constraints alone does not resolve this because the underlying source_gen package has not yet published a compatible release.
This was verified on the latest commit of main (e46854f3). Android Studio is not involved, this is pure Dart code generation and fails on a clean clone.
Impact
dart run build_runner build -d is a required setup step per the README. This blocks all contributors on Flutter stable 3.44.0 from building the app locally.
Possible Fix
Once source_gen publishes a release supporting analyzer 8.x, bumping build_runner and mockito to their latest versions should resolve this. Alternatively, replacing mockito with a code generation approach that does not depend on source_gen 3.x would also fix it. This is related to the broader dependency modernisation tracked in #512.
Environment
Steps to Reproduce
git clone https://github.com/MostroP2P/mobile.git cd mobile flutter pub get dart run build_runner build -dError
Root Cause
build_runner: ^2.4.0resolves tobuild_runner 2.7.1which pullssource_gen 3.1.0. That version callsDartObjectImpl.getInvocation()which was removed inanalyzer 8.x. Flutter 3.44.0 ships Dart 3.12.0 which forcesanalyzer 8.4.1.source_gen 3.2.0does not exist on pub.dev, there is no released version ofsource_genthat supportsanalyzer >=8.0.0. Bumpingbuild_runnerormockitoconstraints alone does not resolve this because the underlyingsource_genpackage has not yet published a compatible release.This was verified on the latest commit of
main(e46854f3). Android Studio is not involved, this is pure Dart code generation and fails on a clean clone.Impact
dart run build_runner build -dis a required setup step per the README. This blocks all contributors on Flutter stable 3.44.0 from building the app locally.Possible Fix
Once
source_genpublishes a release supportinganalyzer 8.x, bumpingbuild_runnerandmockitoto their latest versions should resolve this. Alternatively, replacingmockitowith a code generation approach that does not depend onsource_gen 3.xwould also fix it. This is related to the broader dependency modernisation tracked in #512.