Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions third_party/packages/flutter_svg/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.14

* Makes the package WASM compatible.

## 2.0.13

* Relaxes the dependency constraints on vector_graphics, vector_graphics_codec,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export '_file_io.dart' if (dart.library.html) '_file_none.dart';
export '_file_io.dart' if (dart.library.js_interop) '_file_none.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, this might still rank this package as NOT wasm-compatible in pub due to issues with configuration specific imports.

Better to do

Suggested change
export '_file_io.dart' if (dart.library.js_interop) '_file_none.dart';
export '_file_none.dart' if (dart.library.io) '_file_io.dart';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other PRs that this one relies on have already landed using this version since #8014 (comment) didn't raise any objection.

Could you elaborate on the issue?

Copy link
Contributor Author

@nank1ro nank1ro Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I can confirm this works because I did it with the fork I published, flutter_svg_plus

You can check the platform support inside the score here https://pub.dev/packages/flutter_svg_plus/score

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no doubt that it works at runtime. I'm concerned that the wasm classification on pub.dev will still be broken without this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://pub.dev/api/packages/flutter_svg/metrics

Search for package:flutter_svg/src/utilities/file.dart

Copy link
Contributor Author

@nank1ro nank1ro Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think the score for wasm on pub.dev is wrong, I assure you it is not.
See here https://pub.dev/api/packages/flutter_svg_plus/metrics and here https://pub.dev/api/packages/vector_graphics_compiler/metrics.
The latter is the one which has been already merged using dart.library.js_interop as a conditional import

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See dart-lang/pana#1324

I'm confused; I don't see anything in that issue that says that a conditional import based on js_interop wouldn't work, and it's currently working in practice. Could you point to a specific discussion/comment that makes you think this won't work in the future?

See https://pub.dev/api/packages/flutter_svg/metrics

Search for package:flutter_svg/src/utilities/file.dart

Why are we looking at the published version of flutter_svg, which doesn't have the fix in this PR and still uses dart:html?

6 changes: 3 additions & 3 deletions third_party/packages/flutter_svg/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: flutter_svg
description: An SVG rendering and widget library for Flutter, which allows painting and displaying Scalable Vector Graphics 1.1 files.
repository: https://github.com/flutter/packages/tree/main/third_party/packages/flutter_svg
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_svg%22
version: 2.0.13
version: 2.0.14

environment:
sdk: ^3.4.0
Expand All @@ -12,9 +12,9 @@ dependencies:
flutter:
sdk: flutter
http: ^1.0.0
vector_graphics: ^1.1.11+1
vector_graphics: ^1.1.13
vector_graphics_codec: ^1.1.11+1
vector_graphics_compiler: ^1.1.11+1
vector_graphics_compiler: ^1.1.14

dev_dependencies:
flutter_test:
Expand Down