pub get failed because my_app depends on both json_serializable ^4.0.2 and build_runner ^1.12.1, version solving failed
Thank you for taking the time to file an issue!
In order to route, prioritize, and act on this as soon as possible please include:
- Dart SDK Version (
dart --version) - What package(s) from this repo you are using, and the version (i.e.
build_runner 0.7.12)- If you are not sure, try checking your
pubspec.lockfile.
- If you are not sure, try checking your
- What builder(s) you are using (or writing yourself). Try to give a short summary of what they do.
- Whether you are using Windows, MacOSX, or Linux (if applicable)
- Whether you are using Chrome, Safari, Firefox, Edge (if applicable)
- Any other packages or constraints we should know about
Missing some or all of the above might make the issue take longer or be impossible to act on.
Dart version - Dart VM version: 2.7.1 (Thu Jan 23 13:02:26 2020 +0100) on "macos_x64"
Flutter version -
Packages being used - build_runner 1.12.1
Command being used - flutter pub run build_runner build
OS - Mac OS
Other packages constraint - json_serializable 4.0.2
Steps to Reproduce
- Run
flutter create bug. - Update the
pubspec.yamlfile with the following code -
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
flutter_statusbarcolor: ^0.2.3
provider: ^4.0.3
json_serializable: ^4.0.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.12.1
- Run the project
command: flutter pub run build_runner build should run and create part g.dart files
Running the above command throws an error -
Because build_runner >=1.12.0 depends on build >=2.0.0 <2.1.0 and json_serializable >=4.0.0 depends on build ^1.6.1, build_runner >=1.12.0 is incompatible with json_serializable >=4.0.0.
So, because my_app depends on both json_serializable ^4.0.2 and build_runner ^1.12.1, version solving failed.
pub get failed (1; So, because my_app depends on both json_serializable ^4.0.2 and build_runner ^1.12.1, version solving failed.)
Logs
[✓] Flutter (Channel stable, 2.0.2, on macOS 11.2.2 20D80 darwin-x64, locale en-IN) • Flutter version 2.0.2 at /Users/hussain/FlutterProjects/flutter • Framework revision 8962f6dc68 (2 days ago), 2021-03-11 13:22:20 -0800 • Engine revision 5d8bf811b3 • Dart version 2.12.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0) • Android SDK at /Users/hussain/Library/Android/sdk • Platform android-30, build-tools 30.0.0 • ANDROID_HOME = /Users/hussain/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_242-release-1644-b3-6915495) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.53.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available) • SM M115F (mobile) • R9ZN906MAVT • android-arm • Android 10 (API 29) • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.82
• No issues found!
Duplicate of https://github.com/google/json_serializable.dart/issues/831