pub-dev icon indicating copy to clipboard operation
pub-dev copied to clipboard

Cannot make package that is both a flutter plugin, and has a dart-only side also

Open MichealReed opened this issue 8 months ago • 5 comments

I recently published an update to the package https://pub.dev/packages/minigpu. Before this update, I was using plugins for all platforms, but with 1.0.1 I migrated the library to use native assets. Now that I have published this version, only web shows up for compatibility per the pub.dev analyzer.

This package should show as dart compatible and support all native platforms + web. I am only using a plugin now for web, native assets use the new build hook.

Is there any way to force this until recognition of native assets can be added to the analyzer?

cc: @dcharkes

MichealReed avatar Mar 20 '25 13:03 MichealReed

This is a known issue, cc @jonasfj

Somewhat related, also about surfacing supported platforms from hooks:

  • https://github.com/dart-lang/pub-dev/issues/8010

dcharkes avatar Mar 20 '25 14:03 dcharkes

You can override the detected list of supported platforms by explicitly declaring them: https://pub.dev/help/scoring#:~:text=Declaring%20platforms%3A

sigurdm avatar Mar 20 '25 14:03 sigurdm

You can override the detected list of supported platforms by explicitly declaring them: https://pub.dev/help/scoring#:~:text=Declaring%20platforms%3A

Thanks! Any way to specifically declare dart compatibility too?

MichealReed avatar Mar 20 '25 14:03 MichealReed

No, we haven't yet figured out how to make packages that are flutter plugins sometimes and dart ffi apps sometimes.

Currently the best (but perhaps unsatisfying) advice is to make two separate plugins.

sigurdm avatar Mar 20 '25 14:03 sigurdm

No, we haven't yet figured out how to make packages that are flutter plugins sometimes and dart ffi apps sometimes.

It seems the main hold-up on this is the analyzer forcing the use of flutter pub get when a nested dep relies on a flutter package. If the nested check was disabled or a flag to disable it was introduced, wouldn't these flow as dart packages?

Yes my package nests a web dependency that relies on flutter, native never uses this package so it is never called and should validate as dart.

MichealReed avatar Mar 24 '25 18:03 MichealReed