There are many libraries I use every day from pub and they work. But today I run into a problem with qr_code_scanner
. After installing it with flutter pub add qr_code_scanner
and running flutter pub get
, I get in code:
Same with auto import for classes from this file like QRViewController
. What I also did is running flutter upgrade
, flutter clean
and everything else that came to my mind - still getting this error with that package.
Any other thoughts how can I solve it?
CodePudding user response:
Some of the packages you are using are upgraded to flutter3 and some are still Flutter version < 3. Which is why you might be facing an issue. If you are trying to build an older project I would recommend you to downgrade your package versions which is compatible with flutter < 3 and use flutter version < 3. If you are adding any packages through pub add you might get an error if the pub get is not resolved. Please check the same in terminal.
CodePudding user response:
For anyone who will have the same issue, I found a workaround. I've also tried few other libraries that beside the fact was installed couldn't access them from anywhere in code.
So after all every pub.dev lib is just the code right? You can download the source file and add it into your lib
folder. Well, you have to upgrade it manually if needed but at the end it works and that's the main goal!
EDIT:
Another possible solution, as I found out, I did reset my Mac, upgraded environment (VS Code), done flutter clean
and flutter pub get
and looks like it's working as it should without mentioned workaround so probably the issue was around the coding environment rather than with Flutter and fetched libraries.