'how can I use flutter_test from sdk and the package test? what version of test uses test_api 0.4.3?
I am trying to run some basic unit test for my flutter app. But when I run pub get I get the following error after including test: 1.20.0 in my pubspec:
dev_dependencies:
dependency_validator: ^3.1.0 # run flutter pub run dependency_validator
#integration_test:
# sdk: flutter
flutter_test:
sdk: flutter
test: ^1.20.0
so when I run f pub get
I see:
Because test >=1.20.0 depends on test_api 0.4.9 and every version of flutter_test from sdk depends on test_api 0.4.3, test >=1.20.0 is incompatible with flutter_test from sdk.
So, because myapp depends on both flutter_test from sdk and test ^1.20.0, version solving failed.
pub get failed (1; So, because myapp depends on both flutter_test from sdk and test ^1.20.0, version solving failed.)```
What version of test uses test_api 0.4.3?
Solution 1:[1]
I can just use import 'package:flutter_test/flutter_test.dart'; instead of importing directly from the test package in my test file. So I don't need to include test: 1.20.0 in my pubspec.
Solution 2:[2]
Try overriding test_api to 0.4.9 in your pubspec.yaml file:
dependency_overrides:
test_api: 0.4.9
or
dependency_overrides:
analyzer: ^3.0.0
You can probably remove this next time flutter updates.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | lost baby |
Solution 2 |