Closed dorontal closed 1 year ago
Hi @dorontal 👋 Thanks for opening an issue!
I am not able to reproduce. The pubspec.yaml
I have looks like:
name: example
description: A new Flutter project.
version: 1.0.0+1
publish_to: "none"
environment:
sdk: ">=2.18.4 <3.0.0"
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
mocktail: ^0.3.0
flutter:
uses-material-design: true
And I'm able to run flutter packages get
with no issues.
The generated lock file is:
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "47.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.7.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.1"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.2"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.5"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
mocktail:
dependency: "direct dev"
description:
name: mocktail
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.11"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
test:
dependency: transitive
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.4"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.16"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
vm_service:
dependency: transitive
description:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "9.4.0"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.18.4 <3.0.0"
Does the above pubspec.yaml
not work for you as well?
Hi @felangel, please accept my apologies for reporting less than I should have.
Originally I thought the conflict was with package build_runner
- it is.
Try adding build_runner
as a package - that's when I had the version solving failure.
The pubspec.yaml
for that test code (created by VSCode on new project, with manually added mocktail
and build_runner
) that failed version solving is (relevant excerpt):
dependencies:
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
dev_dependencies:
build_runner: ^2.3.2
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
mocktail: ^0.3.0
Here's a workaround: If you change the version of build_runner
from ^2.3.2
to 2.2.1
version solving works and flutter pub get
doesn't crash. The following dependency combo works:
dependencies:
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
dev_dependencies:
build_runner: 2.2.1
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
mocktail: ^0.3.0
I am also facing the same issue with the following dependecies. When I comment out mocktail, everything seems to work fine.
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
mocktail: ^0.3.0
build_runner: ^2.3.2
freezed_annotation: ^2.2.0
freezed: ^2.2.1
hive_generator: ^2.0.0
Error message
Because test >=1.16.0-nullsafety.19 <1.16.6 depends on test_api 0.2.19 and test >=1.16.6 <1.17.10 depends on analyzer ^1.0.0, test >=1.16.0-nullsafety.19 <1.17.10 requires test_api 0.2.19 or analyzer ^1.0.0.
And because test >=1.17.10 <1.20.0 depends on analyzer >=1.0.0 <3.0.0 and test >=1.20.0 <1.21.2 depends on test_api 0.4.9, test >=1.16.0-nullsafety.19 <1.21.2 requires test_api 0.2.19 or 0.4.9 or analyzer >=1.0.0 <3.0.0.
And because test >=1.21.0 <1.21.6 depends on analyzer >=2.0.0 <5.0.0 and test >=1.21.6 <1.21.7 depends on test_api 0.4.14, test >=1.16.0-nullsafety.19 <1.21.7 requires test_api 0.2.19 or 0.4.9 or 0.4.14 or analyzer >=1.0.0 <5.0.0.
And because test >=1.21.7 <1.22.0 depends on test_api 0.4.15 and test >=1.22.0 depends on test_api 0.4.16, test >=1.16.0-nullsafety.19 requires test_api 0.2.19 or 0.4.9 or 0.4.14 or 0.4.15 or 0.4.16 or analyzer >=1.0.0 <5.0.0.
Because no versions of hive_generator match >2.0.0 <3.0.0 and hive_generator 2.0.0 depends on analyzer ^5.0.0, hive_generator ^2.0.0 requires analyzer ^5.0.0.
Thus, if hive_generator ^2.0.0 and test >=1.16.0-nullsafety.19 then test_api 0.2.19 or 0.4.9 or 0.4.14 or 0.4.15 or 0.4.16.
And because mocktail >=0.1.3 depends on test ^1.16.0, if hive_generator ^2.0.0 and mocktail >=0.1.3 then test_api 0.2.19 or 0.4.9 or 0.4.14 or 0.4.15 or 0.4.16.
And because $PROJECT depends on flutter_test from sdk which depends on test_api 0.4.12, hive_generator ^2.0.0 is incompatible with mocktail >=0.1.3.
So, because $PROJECT depends on both mocktail ^0.3.0 and hive_generator ^2.0.0, version solving failed.
pub get failed (1; So, because $PROJECT depends on both mocktail ^0.3.0 and hive_generator ^2.0.0, version solving failed.)
Same problem for me. Fixed it with test_api
dependency override like:
dependency_overrides: test_api: 0.4.16
Here the stackoverflow answer
Unfortunately, it doesn't appear to be related to mocktail
. The following pubspec.yaml
has the same issue:
name: example
publish_to: none
environment:
sdk: ">=2.18.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
dev_dependencies:
build_runner: ^2.3.2
flutter_test:
sdk: flutter
test: any
With build_runner 2.3.2
and flutter_test
it's not possible to resolve any version of package:test
(https://github.com/flutter/flutter/issues/115284)
Closing this as it appears to be fixed on the master
channel of flutter
.
Describe the bug
it's not possible to use
mocktail
withbuild_runner
- both current versions - seem to clash and version solving reports an error.The current
mocktai
l package v0.3.0
is not building when added to a new project.When you run
flutter pub get
withmocktail
having been just added, you get the following error:To Reproduce Steps to reproduce the behavior:
mocktail
to yourpubspect.yaml
's dev dependenciespubspect.yaml
's dev dependencies`flutter pub get
When you run
flutter pub get
you will see the version solving error .Expected behavior I expected
flutter pub get
to not fail.Logs Run
flutter analyze
and attach any output of that command below.Paste the output of running
flutter doctor -v
here.