Flutter: chopper_generator >=3.0.4 与 moor_generator ^4.1.0 不兼容,如何解决?
Flutter: chopper_generator >=3.0.4 is incompatible with moor_generator ^4.1.0, how to solve?
我把flutter更新到最新版本了:
PS C:\Users\pc> flutter --version
Flutter 2.0.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8962f6dc68 (8 days ago) • 2021-03-11 13:22:20 -0800
Engine • revision 5d8bf811b3
Tools • Dart 2.12.1
并且 运行 flutter doctor 没有问题:
PS C:\Users\pc> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19042.867], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
[√] VS Code (version 1.51.1)
[√] Connected device (3 available)
• No issues found!
所以我创建了一个新的 flutter 项目,并带来了我知道我将要使用的依赖项和包(最新版本在每个文档之后):
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_bloc: ^6.1.3
moor: ^4.1.0
sqlite3_flutter_libs: ^0.4.1
path_provider: ^2.0.1
path: ^1.8.0
firebase_messaging: ^9.0.0
equatable: ^2.0.0
multi_image_picker: ^4.8.0
chopper: ^3.0.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
chopper_generator: ^3.0.4
moor_generator: ^4.1.0
但是当我 运行 pub get 时,我遇到了这个问题,它说 chopper_generator 和 moor_generator 不兼容,如何解决这个问题?我怎样才能找到兼容的版本?很难在其文档中找到每个包的变更日志,而且我似乎没有找到有关分析器版本的任何详细信息......
我需要放弃其中一个包裹吗?
Because analyzer_plugin >=0.2.5 <0.4.0 depends on analyzer ^0.39.12 and
analyzer_plugin >=0.4.0 depends on analyzer ^0.41.0, analyzer_plugin >=0.2.5
requires analyzer ^0.39.12 or ^0.41.0.
And because chopper_generator >=3.0.6 depends on analyzer ^0.40.4,
analyzer_plugin >=0.2.5 is incompatible with chopper_generator >=3.0.6.
And because chopper_generator >=3.0.5 <3.0.6 depends on analyzer ^0.39.8 and
chopper_generator >=3.0.4 <3.0.5 depends on analyzer ^0.39.0, if
analyzer_plugin >=0.2.5 and chopper_generator >=3.0.4 then analyzer ^0.39.0.
And because moor_generator >=4.1.0 <4.2.0 depends on analyzer >=0.40.0
<0.43.0 and moor_generator >=4.0.0-dev <4.2.0 depends on analyzer_plugin
>=0.3.0 <0.5.0, chopper_generator >=3.0.4 is incompatible with moor_generator
>=4.1.0 <4.2.0.
And because no versions of moor_generator match >4.2.0 <5.0.0 and
moor_generator 4.2.0 depends on build_resolvers ^2.0.0, if chopper_generator
>=3.0.4 and moor_generator ^4.1.0 then build_resolvers ^2.0.0.
And because no versions of build_resolvers match >2.0.0 <3.0.0 and
build_resolvers 2.0.0 depends on logging ^1.0.0, if chopper_generator >=3.0.4
and moor_generator ^4.1.0 then logging ^1.0.0.
Because chopper_generator >=3.0.5 depends on logging ^0.11.4 and
chopper_generator >=0.1.0 <3.0.5 depends on logging ^0.11.0,
chopper_generator >=0.1.0 requires logging ^0.11.0.
Thus, chopper_generator >=3.0.4 is incompatible with moor_generator ^4.1.0.
So, because fournisseur depends on both chopper_generator ^3.0.4 and
moor_generator ^4.1.0, version solving failed.
pub get failed (1; So, because fournisseur depends on both chopper_generator
^3.0.4 and moor_generator ^4.1.0, version solving failed.)
Process finished with exit code 1
一种可能的解决方案是降低其中一个库的版本,直到它们相互兼容。
在使用 flutter 几个月后,我找到了一个更好的解决方案,用于解决 flutter 中的依赖冲突。
我通过将冲突依赖项的版本设置为 any
让 pubspec 自动处理兼容版本。
例如:
chopper_generator: any
hive_generator: any
在获得依赖项后,我检查 pubspec.lock
使用的版本,然后我用 .lock
文件中找到的选定版本覆盖 any
。
注意:我保留了另一个答案,因为它当时(几个月前)对我有帮助。
我把flutter更新到最新版本了:
PS C:\Users\pc> flutter --version
Flutter 2.0.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8962f6dc68 (8 days ago) • 2021-03-11 13:22:20 -0800
Engine • revision 5d8bf811b3
Tools • Dart 2.12.1
并且 运行 flutter doctor 没有问题:
PS C:\Users\pc> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19042.867], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
[√] VS Code (version 1.51.1)
[√] Connected device (3 available)
• No issues found!
所以我创建了一个新的 flutter 项目,并带来了我知道我将要使用的依赖项和包(最新版本在每个文档之后):
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_bloc: ^6.1.3
moor: ^4.1.0
sqlite3_flutter_libs: ^0.4.1
path_provider: ^2.0.1
path: ^1.8.0
firebase_messaging: ^9.0.0
equatable: ^2.0.0
multi_image_picker: ^4.8.0
chopper: ^3.0.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
chopper_generator: ^3.0.4
moor_generator: ^4.1.0
但是当我 运行 pub get 时,我遇到了这个问题,它说 chopper_generator 和 moor_generator 不兼容,如何解决这个问题?我怎样才能找到兼容的版本?很难在其文档中找到每个包的变更日志,而且我似乎没有找到有关分析器版本的任何详细信息...... 我需要放弃其中一个包裹吗?
Because analyzer_plugin >=0.2.5 <0.4.0 depends on analyzer ^0.39.12 and
analyzer_plugin >=0.4.0 depends on analyzer ^0.41.0, analyzer_plugin >=0.2.5
requires analyzer ^0.39.12 or ^0.41.0.
And because chopper_generator >=3.0.6 depends on analyzer ^0.40.4,
analyzer_plugin >=0.2.5 is incompatible with chopper_generator >=3.0.6.
And because chopper_generator >=3.0.5 <3.0.6 depends on analyzer ^0.39.8 and
chopper_generator >=3.0.4 <3.0.5 depends on analyzer ^0.39.0, if
analyzer_plugin >=0.2.5 and chopper_generator >=3.0.4 then analyzer ^0.39.0.
And because moor_generator >=4.1.0 <4.2.0 depends on analyzer >=0.40.0
<0.43.0 and moor_generator >=4.0.0-dev <4.2.0 depends on analyzer_plugin
>=0.3.0 <0.5.0, chopper_generator >=3.0.4 is incompatible with moor_generator
>=4.1.0 <4.2.0.
And because no versions of moor_generator match >4.2.0 <5.0.0 and
moor_generator 4.2.0 depends on build_resolvers ^2.0.0, if chopper_generator
>=3.0.4 and moor_generator ^4.1.0 then build_resolvers ^2.0.0.
And because no versions of build_resolvers match >2.0.0 <3.0.0 and
build_resolvers 2.0.0 depends on logging ^1.0.0, if chopper_generator >=3.0.4
and moor_generator ^4.1.0 then logging ^1.0.0.
Because chopper_generator >=3.0.5 depends on logging ^0.11.4 and
chopper_generator >=0.1.0 <3.0.5 depends on logging ^0.11.0,
chopper_generator >=0.1.0 requires logging ^0.11.0.
Thus, chopper_generator >=3.0.4 is incompatible with moor_generator ^4.1.0.
So, because fournisseur depends on both chopper_generator ^3.0.4 and
moor_generator ^4.1.0, version solving failed.
pub get failed (1; So, because fournisseur depends on both chopper_generator
^3.0.4 and moor_generator ^4.1.0, version solving failed.)
Process finished with exit code 1
一种可能的解决方案是降低其中一个库的版本,直到它们相互兼容。
在使用 flutter 几个月后,我找到了一个更好的解决方案,用于解决 flutter 中的依赖冲突。
我通过将冲突依赖项的版本设置为 any
让 pubspec 自动处理兼容版本。
例如:
chopper_generator: any
hive_generator: any
在获得依赖项后,我检查 pubspec.lock
使用的版本,然后我用 .lock
文件中找到的选定版本覆盖 any
。
注意:我保留了另一个答案,因为它当时(几个月前)对我有帮助。