-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter and non-flutter dependency conflict with "platforms" pubspec key #2606
Comments
I have the same problem with package:webcrypto, and I kind of knew #2265 would cause this problem for a few packages. We don't really support distributing "Dart plugins" on pub.dev, the way we have support for "Flutter plugins". In the mean time, it possible to distribute packages on pub.dev that uses I suppose it is possible to publish two versions of the package with different pubspecs... Something like: I'm not sure it's wise to allow publishing flutter plugins that doesn't have an SDK constraint on Flutter. The fact that this was possible in the past was probably a bug. |
Two versions might be a bit unwise... Because an incompatible flutter version would then pick the pure-Dart version that doesn't work for it. It's probably better to make two packages The downside is that downstream packages will have to pick which of your two packages they target. |
@jonasfj thanks, those are the options we were discussing as well, or alternatively, having just a |
That sounds like a good solution.
Me neither... long-term we'll have to come up with a proper solution for "Dart plugins", so that these just work on Flutter and Dart. |
The ironic thing is that we don't need "plugins". We are looking into plugins only as a workaround for a change introduced in Flutter 1.20. I think what we really try to do is something like a "platform aware Dart package". We provide native libraries (currently Android and iOS and will do Windows, Linux, macOS later), which are used from Dart directly. As we have no use for plugins, we provide dummy implementations to make Flutter happy (iOS lib is not picked up otherwise). |
Oh, so you provide native binaries? You don't ship source as part of the plugin? |
Yes, https://pub.dev/packages/objectbox creates a dart wrapper around the native objectbox-c library https://pub.dev/packages/objectbox depends on http://github.com/objectbox/objectbox-c which is provided as a native library (.so/.dylib/.framework/.dll binary lib) + headers. For iOS and Android, we take the built objectbox-c binary library artifact from objectbox-swift and objectbox-java projects respectively - just because those projects use the same lib as well and already have the builds for the target platforms in place. |
Closing in favor of #3693. |
Environment
pub version
orflutter pub version
: Pub 2.8.4Problem
I'm maintaining a package that supports both "plain" dart native and flutter (ios, android) and wanted to update pubspec to the new format including "platforms".
After adding
platforms
key to the pubspec.yaml,pub publish
prints the following error (see this PR #2265):OK, so I add flutter to the environment and pub publish works now:
But this change has dropped the non-flutter (plain dart) support so dart-only packages depending on this lib are broken:
Proposed solution
Change the
pub publish
error to warning so the package with theplatforms
key can be publish even if it doesn't specify the dependency on flutter explicitly.The text was updated successfully, but these errors were encountered: