How to switch off unneeded plugin which produce error?

Viewed 277

How to solve flutter run(build) error:

flutter/.pub-cache/hosted/pub.dartlang.org/device_info_plus_windows-2.1.1/lib/src/device_info_plus_windows.dart:24:35: Error: Required named parameter

'userName' must be provided. [ ] final data = WindowsDeviceInfo(

I don't need windows-plugin in the dependencies of device_info_plus plugin. Flutter doctor all is ok How to switch off "device_info_plus_windows" plugin in the project ?

4 Answers

The problem is about you're using ^ in your library's version in file pubspec.yaml which may harm your code if the lib has an update

Just remove that ^ and try again

On my side the library that caused the problem is

device_info_plus and flutter_secure_storage

But, If you have another dependency eg. catcher:^0.6.8 that cannot update the device_info_plus to latest or 4.0.2

so add this to pubspec.yaml below dependencies:

dependency_overrides: device_info_plus: '4.0.0' device_info_plus_platform_interface: '2.3.0'

enter image description here

the issue will resolve for me and all of my team.

flutter/.pub-cache/...

Whenever you have problems like these, i.e. unwanted stuff in your cache, you need to clean your workspace before compiling again.

Ensure you've removed all of the unwanted dependencies from your pubspec.yaml.

Then, in your current working directory (cwd), run:

flutter clean && flutter pub get && flutter run

This should be enough.

Have the same issue

Worked for me:

flutter clean && flutter pub get

flutter upgrade --force
flutter pub upgrade --major-versions
Related