go-flutter-desktop / go-flutter

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
https://hover.build/
BSD 3-Clause "New" or "Revised" License
5.88k stars 283 forks source link

Deprecate plugins that are implemented by the flutter team in pure dart #583

Open provokateurin opened 3 years ago

provokateurin commented 3 years ago

Some plugins like shared_preferences have been implemented in pure dart: https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_linux. We should deprecate those plugins (and all other plugins that are now available this way) in the plugins repository, because it causes a lot of confusion why an app can still remember something while the data has been cleared (happened to me twice). Also we should maybe promote all plugins that are implemented in pure dart in the readme of the repository, because they also work for us and maybe there are even some that haven't been implemented by us yet.

EDIT: url_launcher isn't implemented in pure dart.

pchampio commented 3 years ago

Can you submit a PR on the plugin repo removing the plugins that don't need specific platform implementation ?

provokateurin commented 3 years ago

I'm not sure if that is the best way, because it will break apps. Is there a possibility we can show a warning when one of those plugins is used and after a while we remove it completely?

pchampio commented 3 years ago

Yea, by creating new versions: https://github.com/go-flutter-desktop/plugins/releases And modifying:

https://github.com/go-flutter-desktop/plugins/blob/a4e7164360e07c729802ff2dec6be484eb1de4cd/shared_preferences/import.go.tmpl#L10-L16
provokateurin commented 3 years ago

But that would only apply to people who install the plugin the first time, after that the template file won't be updated, right? I think printing the warning at runtime is a better option, because it will warn everyone regardless of their setup.

provokateurin commented 3 years ago

I did it that way, but maybe I'm wrong? Anyway the solution should work

stuartmorgan commented 3 years ago

Be aware that the mechanism by which you are automatically picking up the Dart implementations is temporary. Once that's resolved, you'll get the the method channel implementation by default again unless you implement auto-registration of Dart plugins.