mogol / flutter_secure_storage

A Flutter plugin to store data in secure storage
https://pub.dartlang.org/packages/flutter_secure_storage
BSD 3-Clause "New" or "Revised" License
1.09k stars 340 forks source link

Update js dependency and migrate to web #680

Closed ThexXTURBOXx closed 1 month ago

ThexXTURBOXx commented 4 months ago

This allows newer versions of js being used in conjunction with flutter_secure_storage. Also, as html is about to get phased out, this PR already migrates to web as it is recommended practice to do so.

Fixes #670 Fixes #679 Fixes #683

If you want to use this now, you can do so via a dependency_override:

dependency_overrides:
  flutter_secure_storage:
    git:
      url: https://github.com/ThexXTURBOXx/flutter_secure_storage.git
      ref: develop
      path: flutter_secure_storage

You probably need to also override the other subpackages similarly (I won't explain how to do that. Just do it as I have shown with the main package above).

ThexXTURBOXx commented 4 months ago

This PR now also migrates from html to web since package maintainers are advised to do so sooner than later

JgomesAT commented 4 months ago

Is there any date to merge this and create a new version??

ThexXTURBOXx commented 4 months ago

@JgomesAT I don't even know if this will ever get merged as the repo owner is not very active currently. For the time being, you can use my fork through a dependency_override

JgomesAT commented 4 months ago
dependency_overrides:
  flutter_secure_storage:
    git:
      url: https://github.com/ThexXTURBOXx/flutter_secure_storage.git
      ref: develop
      path: flutter_secure_storage

With the version of your repo I have an error in compilation:

../../../../.pub-cache/git/flutter_secure_storage-6ac827e457393b5c654c1abda40d31e2cb93f62c/flutter_secure_storage/lib/flutter_secure_storage.dart:268:17: Error: The getter 'onCupertinoProtectedDataAvailabilityChanged' isn't defined for the class 'FlutterSecureStoragePlatform'.

ThexXTURBOXx commented 4 months ago

You probably need to override the other packages as well

JgomesAT commented 4 months ago

You probably need to override the other packages as well

What other package??

ThexXTURBOXx commented 4 months ago

As described above, the platform interface and web submodules (and probably also linux etc.

JgomesAT commented 4 months ago

As described above, the platform interface and web submodules (and probably also linux etc.

but this library is part of the flutter_storage I don't have this library in the pubspec

JgomesAT commented 4 months ago

IF I put your repo in the pubspec dependencies: and the old one in the dependencies_override

dependencies: flutter_secure_storage: git: url: https://github.com/ThexXTURBOXx/flutter_secure_storage.git ref: develop path: flutter_secure_storage

dependency_overrides:
flutter_secure_storage: ^9.0.0

I have a successful build

ThexXTURBOXx commented 4 months ago

IF I put your repo in the pubspec dependencies: and the old one in the dependencies_override

@JgomesAT Then, you are using the official version

but this library is part of the flutter_storage I don't have this library in the pubspec

You have all these packages in your pubspec.lock and hence you will need to override all of them. Please refrain from commenting under this PR unless there is an issue with my code. For further information, please consult StackOverflow instead.

JgomesAT commented 4 months ago

I think that is an issue of your code I only use your repo, and I removed all references of package flutter_secure_storage: ^9.0.0 the error is in the run in a flutter in a web in debug mode in an Apple(iMAC) device

ThexXTURBOXx commented 4 months ago

This is an issue with your current setup. Take a look inside your pubspec.lock (NOT pubspec.yaml). You will need to override ALL the packages that start with flutter_secure_storage. Then it works without any problems. I won't answer any questions not related to my code here anymore.

JgomesAT commented 4 months ago

I'm sorry, but I didn't understand, this behavior is strange I need to add all submodules, in a possible final merge of the library this won't be necessary, will it?

example I need to add this in the override:

flutter_secure_storage_platform_interface: git: url: https://github.com/ThexXTURBOXx/flutter_secure_storage.git ref: develop path: flutter_secure_storage_platform_interface

ThexXTURBOXx commented 4 months ago

Exactly, after merging and releasing these changes properly to pub.dev, this won't be necessary anymore.

ombhd commented 2 months ago

Will this be merged soon?

StefanTasevski commented 2 months ago

Can this get merged? @ThexXTURBOXx

ThexXTURBOXx commented 2 months ago

I think yes. Someone might want to migrate some stuff to js_interop, though

jtavio commented 2 months ago

When will you make the merge of this?

ThexXTURBOXx commented 1 month ago

@juliansteenbakker Since I have seen that you are about to incorporate this, I want to mention that the js_interop migration from #698 should also be considered. A mixture of this PR right here and #698 is probably the best way to go. Do you want me to rebase my PR right here onto your upstream master?

juliansteenbakker commented 1 month ago

Hi @ThexXTURBOXx , that would be awesome ! I am planning on releasing a smaller version with bug fixes first today, and a new major version with some breaking changes and possibly this PR somewhere in the end of this week.

ThexXTURBOXx commented 1 month ago

@juliansteenbakker Done! :)

juliansteenbakker commented 1 month ago

I have released v9.1.0 which has all fixes that are possible for the current lower sdk version. So i will now merge this, and the next release (v10) will use the higher sdk version.