Skip to content

refactor(io): replace universal_io with internal lightweight solution#237

Merged
Fintasys merged 3 commits intoFintasys:masterfrom
hm21:master
Nov 23, 2025
Merged

refactor(io): replace universal_io with internal lightweight solution#237
Fintasys merged 3 commits intoFintasys:masterfrom
hm21:master

Conversation

@hm21
Copy link
Contributor

@hm21 hm21 commented Mar 13, 2025

Description

This PR removes the dependency on universal_io and 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

  • Added io_helper.dart and io_web.dart to handle platform-specific I/O operations.
  • Updated emoji_picker.dart and emoji_picker_internal_utils.dart to use the new internal I/O solution.
  • Modified pubspec.yaml to remove universal_io.
  • Ensured web builds correctly use io_web.dart, fixing the wasm compatibility issue.

Why this change?

  • Reduces external dependencies.
  • Provides a more lightweight and maintainable internal solution.
  • Fixes the wasm compatibility warning on pub.dev.

Testing

  • Verified that all existing functionality remains intact.
  • Tested on relevant platforms, including web, to ensure compatibility.

Checklist

  • Code changes do not introduce breaking changes.
  • Tested on different platforms, including web.
  • Documentation/comments updated if necessary.

Btw, thanks for creating this amazing package, it's really a Flutter gem!

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.
@Fintasys
Copy link
Owner

@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 {
Copy link
Owner

Choose a reason for hiding this comment

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

Is it copied from somewhere? Can you add a reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@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.

Copy link
Owner

Choose a reason for hiding this comment

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

Seems you are more familiar with this than me. I would say link in the file and entry in notice should be good!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I’ve added the original license header to the file and created the NOTICE file as requested.

Copilot AI review requested due to automatic review settings August 18, 2025 08:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_io dependency 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.

Copy link
Owner

@Fintasys Fintasys left a comment

Choose a reason for hiding this comment

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

LGTM, Thank you ! Sorry for the delay

@Fintasys Fintasys merged commit 4240861 into Fintasys:master Nov 23, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants