flutter_secure_storage icon indicating copy to clipboard operation
flutter_secure_storage copied to clipboard

flutter pub add flutter_secure_storage installs 4.2.1 instead of 9.2.4

Open basvdijk opened this issue 9 months ago • 5 comments

When I run flutter pub add flutter_secure_storage

It adds flutter_secure_storage: ^4.2.1 to my pubspec.yaml instead of a version 9. I don't know what is causing this, but just so you know.

basvdijk avatar Feb 22 '25 14:02 basvdijk

@basvdijk I had the same issue once, for that reason the app shows namespace error in the console. When i changed the version to latest manually in the pubspec solved the problem. But don't know the exact reason !

rithik20 avatar Feb 27 '25 05:02 rithik20

I got the same issue. When running flutter pub add flutter_secure_storage , got flutter_secure_storage: ^4.2.1 installed,

Had to manually update to the latest by changing the number to 9.2.4

ZeroToHero-StepByStep avatar Mar 20 '25 11:03 ZeroToHero-StepByStep

@ZeroToHero-StepByStep Hope it's working right?

rithik20 avatar Mar 20 '25 11:03 rithik20

Yes, manually change it to the latest is working all good. But I don't know what's the reason behind that.

Had try to invalid cache of my intelliJ. pub clean & pub get flutter pub outdated , flutter pub upgrade; and rm pubspec.lock flutter pub get

after a bunch of the combination above, running pub add again , none of these works to run flutter pub add flutter_secure_storage to install the latest , still 4.21 .

Interestingly, when I create a new project, running flutter pub add flutter_secure_storage does get flutter_secure_storage: ^9.2.4

I think it was one of the libraries stops it using the latest. but running

flutter pub deps | grep flutter_secure_storage;

├── flutter_secure_storage 4.2.1
 flutter --version;
Flutter 3.27.0 • channel stable • https://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:[email protected]/flutter/flutter.git
Framework • revision 8495dee1fd (3 months ago) • 2024-12-10 14:23:39 -0800
Engine • revision 83bacfc525
Tools • Dart 3.6.0 • DevTools 2.40.2

Didn't see any suspects.

It is okay for experienced developers, cause we know what we are doing, but this could be an annoying issue to new beginners and people may need to look into this.

The current library resolving could be somewhere wrong, resolved as 4.2.1 , but should use / upgrade to the latest 9.2.4. Yes, this will be an issue to upgrade the library as well potentially.

Anyway, I will stop here for now.

ZeroToHero-StepByStep avatar Mar 20 '25 12:03 ZeroToHero-StepByStep

I had the same issue, then i added manually flutter_secure_storage: ^9.2.4 into pubsec.yaml

charindithjaindu avatar May 02 '25 15:05 charindithjaindu

⚠️ This issue has been marked as stale because it has been open for 60 days with no activity.

If this issue is still relevant, please comment to keep it active. Otherwise, it will be closed in 60 days.

github-actions[bot] avatar Jul 02 '25 03:07 github-actions[bot]

As far as I can see the issue is still valid

basvdijk avatar Jul 02 '25 05:07 basvdijk

Hello,

When I run:

flutter pub add flutter_secure_storage

it installs version 4.2.1, even though the latest version is 9.2.4.

With 4.2.1, Android build fails on AGP 8+ due to missing namespace in build.gradle:

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
Namespace not specified. Specify a namespace in the module's build file: .../flutter_secure_storage-4.2.1/android/build.gradle

Workaround: Manually updating pubspec.yaml to version 9.2.4 resolves the issue.

It seems that flutter pub add pulls an outdated version based on dependency constraints or Flutter SDK version, which causes build problems on modern Android setups.

dilberates avatar Aug 13 '25 12:08 dilberates