refactor(io): replace universal_io with internal lightweight solution#237
refactor(io): replace universal_io with internal lightweight solution#237Fintasys merged 3 commits intoFintasys:masterfrom
Conversation
Replaced the universal_io package with an internal implementation to reduce dependencies and improve efficiency. Added `io_helper.dart` and `io_web.dart` for handling platform-specific I/O operations. Updated `emoji_picker.dart` and `emoji_picker_internal_utils.dart` to use the new solution. Modified `pubspec.yaml` to remove universal_io.
|
@hm21 Thanks for your contribution and extremely sorry for late reply. I will try to catch up with recent issues an PR's soon. |
| /// the hostname of the computer, the value of environment variables, | ||
| /// the path to the running program, | ||
| /// and other global properties of the program being run. | ||
| class Platform { |
There was a problem hiding this comment.
Is it copied from somewhere? Can you add a reference?
There was a problem hiding this comment.
@Fintasys Yes, you’re right, it’s a super-minified version from universal_io. I can add the reference directly in that file if you want, but wouldn’t it be better to create a NOTICES file (similar to LICENSE) and add the license from the universal_io package there?
That way, the license is also included when a user opens the Flutter prebuilt license page, for example via showAboutDialog. Technically, you can also add it using the LicenseRegistry.addLicense method, but personally, I prefer to create a NOTICES file.
We could also do both, or just put it in the file header, whatever you prefer.
There was a problem hiding this comment.
Seems you are more familiar with this than me. I would say link in the file and entry in notice should be good!
There was a problem hiding this comment.
Okay, I’ve added the original license header to the file and created the NOTICE file as requested.
There was a problem hiding this comment.
Pull Request Overview
This PR removes the external universal_io dependency and replaces it with an internal lightweight solution to address WASM compatibility warnings on pub.dev and reduce external dependencies.
- Removes
universal_iodependency from pubspec.yaml - Implements custom platform-specific I/O handling with conditional exports
- Updates import statements to use the new internal I/O helper
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pubspec.yaml | Removes universal_io dependency |
| lib/src/emoji_picker_internal_utils.dart | Updates import to use internal I/O helper |
| lib/src/emoji_picker.dart | Updates import to use internal I/O helper |
| lib/src/core/io/io_web.dart | Adds web-specific Platform implementation |
| lib/src/core/io/io_helper.dart | Adds conditional export for platform-specific I/O |
| NOTICES | Adds license attribution for derived code |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Fintasys
left a comment
There was a problem hiding this comment.
LGTM, Thank you ! Sorry for the delay
Description
This PR removes the dependency on
universal_ioand replaces it with an internal, lightweight implementation. This change helps reduce external dependencies while maintaining the same functionality.Additionally, this update resolves the WASM compatibility warning on pub.dev.
I encountered the same warning in my package, pro_image_editor, indicating that it is not WASM-compatible. This issue arises because my package depends on yours, which in turn depends on
universal_io.Changes
io_helper.dartandio_web.dartto handle platform-specific I/O operations.emoji_picker.dartandemoji_picker_internal_utils.dartto use the new internal I/O solution.pubspec.yamlto removeuniversal_io.io_web.dart, fixing the wasm compatibility issue.Why this change?
Testing
Checklist
Btw, thanks for creating this amazing package, it's really a Flutter gem!