0

So, I added two devDependencies in flutter pubspec.yml:


dev_dependencies:
  flutter_test:
    sdk: flutter
  shared_preferences: ^2.0.0-nullsafety
  http: ^0.13.0-nullsafety.0

Both shared_preferences and http versions are based upon null safety. The flutter application is working perfectly before including these.

But after I try running the app I get the following error:

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:plugin_platform_interface

For solutions, see https://dart.dev/go/unsound-null-safety

I am not sure which package has a dependency to plugin_platform_interface, but how can I solve this without overriding the null-safety rule for code execution?

I don't want to run the code without null-safety. I didn't include plugin_platform_interface anywhere in the dependencies but still getting an error with respect to the same package.

Edit: Moving the dependencies to dependencies from dev_dependencies doesn't solve the problem. Nor does replacing the versions by any

Phoenix
  • 373
  • 1
  • 4
  • 20
  • Does this answer your question? [Cannot run with sound null safety because dependencies don't support null safety](https://stackoverflow.com/questions/64917744/cannot-run-with-sound-null-safety-because-dependencies-dont-support-null-safety) – Dipak Ramoliya Jan 22 '22 at 06:27
  • Why are you using such ancient versions of `http` and `shared_preferences`? And why are they under `dev_dependencies` not regular `dependencies`? Change the version to `any` and let the solver do its magic. For example `http: any`. (It's also considered good form to list dependencies alphabetically.) – Richard Heap Jan 22 '22 at 12:31
  • Making them `any` I think adds non-null safe dependencies. This was not working – Phoenix Jan 22 '22 at 13:13
  • almost everything is null safe now - you can check at https://pub.dev/packages/http - in the second row you see "null safe" – Richard Heap Jan 22 '22 at 22:03

0 Answers0