flutter / flutter/flutter

[video_player] Pub reports that the Package is not compatible with platform Web

Open
#160,300 11 comments 0 reactions 0 assignees View on GitHub
p: requires breaking change p: video_player P3 package team-ecosystem triaged-ecosystem
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### What package does this bug report belong to?

video_player

### What target platforms are you seeing this bug on?

Web

### Have you already upgraded your packages?

Yes

### Dependency versions

pubspec.lock

```lock
N/A
```

### Steps to reproduce

1. Open https://pub.dev/packages/video_player/score
2. It says "Package not compatible with platform Web"

### Expected results

Since the package declares Web support, I would expect no issues reported on the score page.

### Actual results

It says "Package not compatible with platform Web"

Because:

package:video_player/video_player.dart that imports:
dart:io

Similarly, it reports there is no wasm support for the same reason.

Assuming the static analysis is as intended, it would be nice if this 1st party package set an example for how to conditionally import `dart:io`. Ironically, one of the main reasons Flutter plugins import `dart:io` is simply to do platform checks:

```dart
if (!kIsWeb && Platform.isXYZ)
```

So maybe there needs to be a more convenient way to do this that doesn't get flagged as not supporting web. Although in the case of video_player, it actually does use the `File` API.

### Code sample

Code sample

```dart
N/A
```

### Screenshots or Videos

Screenshots / Video demonstration

[Upload media here]

### Logs

Logs

```console
[Paste your logs here]
```

### Flutter Doctor output

Doctor output

```console
N/A
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.