flutterflutter-test

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

  • 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.