Skip to content
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

Packages cannot declare which platforms they support #889

Closed
timsneath opened this issue May 26, 2021 · 5 comments
Closed

Packages cannot declare which platforms they support #889

timsneath opened this issue May 26, 2021 · 5 comments

Comments

@timsneath
Copy link

timsneath commented May 26, 2021

With the advent of FFI, there are an increasing number of packages (not platform plugins) that contain only Dart code, but which are designed to work on only certain platforms. This will increase as we add more platforms and transition more code to adopt FFI, since it will be increasingly infeasible for a platform integration package to support the wide range of platforms that Dart itself supports.

As an obvious example, the win32 package by design only supports Windows, but it doesn't have any means to enumerate that.
image

This leads to customer confusion. For example:
halildurmus/filepicker_windows#9 (comment)
dart-windows/win32#166

One potential solution would be to have an entry in pubspec.yaml for supported_platforms which would override the detection logic built into pana and allow plugin authors to explicitly declare which platforms they choose to support.

@alann-maulana
Copy link

alann-maulana commented Jul 27, 2021

Finally found this issue. It happen when publishing a package meant for all Flutter platforms.

Using native package flutter_image_compress for both Android and iOS, otherwise (Web, MacOS, Windows & Linux) is using pure Dart package image_compression.

So when image_compression_flutter published it only detects Android, iOS and Web platforms only.

Result of pana check
~!$ pana -s path . --no-warning
## ✓ Follow Dart file conventions (20 / 20)
### [*] 10/10 points: Provide a valid `pubspec.yaml`


### [*] 5/5 points: Provide a valid `README.md`


### [*] 5/5 points: Provide a valid `CHANGELOG.md`


## ✓ Provide documentation (10 / 10)
### [*] 10/10 points: Package has an example

* Found example at: `example/lib/main.dart`

## ✓ Support multiple platforms (20 / 20)
### [*] 20/20 points: Supports 3 of 3 possible platforms (**iOS**, **Android**, **Web**)

Found 4 issues. Showing the first 2:


These issues are present but do not affect the score, because they may not originate in your package:

<details>
<summary>
Package does not support Flutter platform Windows
</summary>

Because:
* `package:image_compression_flutter/image_compression_flutter.dart` that imports:
* `package:image_compression_flutter/src/compressor_io.dart` that imports:
* `package:image_compression_flutter/src/flutter_compressor.dart` that imports:
* `package:flutter_image_compress/flutter_image_compress.dart` that declares support for platforms: Android, iOS
</details>

## ✓ Pass static analysis (30 / 30)
### [*] 30/30 points: code has no errors, warnings, lints, or formatting issues


## ✓ Support up-to-date dependencies (20 / 20)
### [*] 10/10 points: All of the package dependencies are supported in the latest version

|Package|Constraint|Compatible|Latest|
|:-|:-|:-|:-|
|[`flutter`]|`flutter`|0.0.0|0.0.0|
|[`flutter_image_compress`]|`^1.0.0`|1.0.0|1.0.0|
|[`image_compression`]|`^1.0.3`|1.0.3|1.0.3|

<details><summary>Transitive dependencies</summary>

|Package|Constraint|Compatible|Latest|
|:-|:-|:-|:-|
|[`archive`]|-|3.1.2|3.1.2|
|[`characters`]|-|1.1.0|1.1.0|
|[`collection`]|-|1.15.0|1.15.0|
|[`crypto`]|-|3.0.1|3.0.1|
|[`image`]|-|3.0.2|3.0.2|
|[`meta`]|-|1.3.0|1.7.0|
|[`mime`]|-|1.0.0|1.0.0|
|[`path`]|-|1.8.0|1.8.0|
|[`petitparser`]|-|4.1.0|4.2.0|
|[`sky_engine`]|-|0.0.99|0.0.99|
|[`typed_data`]|-|1.3.0|1.3.0|
|[`vector_math`]|-|2.1.0|2.1.0|
|[`xml`]|-|5.1.2|5.1.2|
</details>

To reproduce run `dart pub outdated --no-dev-dependencies --up-to-date --no-dependency-overrides`.

[`flutter`]: https://pub.dev/packages/flutter
[`flutter_image_compress`]: https://pub.dev/packages/flutter_image_compress
[`image_compression`]: https://pub.dev/packages/image_compression
[`archive`]: https://pub.dev/packages/archive
[`characters`]: https://pub.dev/packages/characters
[`collection`]: https://pub.dev/packages/collection
[`crypto`]: https://pub.dev/packages/crypto
[`image`]: https://pub.dev/packages/image
[`meta`]: https://pub.dev/packages/meta
[`mime`]: https://pub.dev/packages/mime
[`path`]: https://pub.dev/packages/path
[`petitparser`]: https://pub.dev/packages/petitparser
[`sky_engine`]: https://pub.dev/packages/sky_engine
[`typed_data`]: https://pub.dev/packages/typed_data
[`vector_math`]: https://pub.dev/packages/vector_math
[`xml`]: https://pub.dev/packages/xml


### [*] 10/10 points: Package supports latest stable Dart and Flutter SDKs


## ✓ Support sound null safety (20 / 20)
### [*] 20/20 points: Package and dependencies are fully migrated to null safety!


Points: 120/120.

Edit : finally found a way to solve it

@dnfield
Copy link

dnfield commented Oct 13, 2021

I have a somewhat related issue: flutter_svg does work on web, but imports dart:io and so it gets marked as not working on web, even though it imports dart:io in a safe manner (it does so in precisely the same way that Flutter itself does for images).

@mit-mit
Copy link
Member

mit-mit commented Jan 21, 2022

This has landed, but we still need to get docs updated on https://dart.dev/tools/pub/pubspec

@jonasfj
Copy link
Member

jonasfj commented Feb 1, 2022

Missing documentation is fixed with dart-lang/site-www#3793

@sigurdm
Copy link
Contributor

sigurdm commented Feb 10, 2022

This is done!

@sigurdm sigurdm closed this as completed Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants