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

Web safe export #59

Closed
wants to merge 3 commits into from
Closed

Web safe export #59

wants to merge 3 commits into from

Conversation

busslina
Copy link

@busslina busslina commented Feb 4, 2024

#58

@Bungeefan
Copy link
Member

Hi, thanks for the PR, I am currently still contemplating whether we should solve it this way, or if there are other ways without having to provide two different library exports.
I would like to keep it as simple as possible for library users.

Anyway, regarding your changes, I see no reason why you changed the imports of the tests and I also wouldn't like to call it logger_web_safe.
logger_web seems to conform better to the common naming scheme of such export files in packages.

@busslina
Copy link
Author

busslina commented Feb 13, 2024

Hi, thanks for the PR, I am currently still contemplating whether we should solve it this way, or if there are other ways without having to provide two different library exports. I would like to keep it as simple as possible for library users.

Anyway, regarding your changes, I see no reason why you changed the imports of the tests and I also wouldn't like to call it logger_web_safe. logger_web seems to conform better to the common naming scheme of such export files in packages.

Both of your question have the same answer: I had this very same problem with my own libs and I adopted the same strategy. To create a 'web_safe_lib.dart' file and to use this export file instead the main one when it's possible.

But it can be done in a better way for sure ;)

As side note, I'm using this PR in my logger fork successfully.

Thanks

@Bungeefan
Copy link
Member

Actually, I found a "better" way to fix the import problem without needing to provide a second library.
We can just use String path instead of File file in the constructor parameter, similar to various other libraries (e.g. dio, cross_file, ...).
This would remove the dart:io import from the stub, which in turn fixes the complaint from the Dart web compiler.

However, as this would be a breaking change, I will probably add the web-safe library for now and change it in a future major release.

@Bungeefan Bungeefan closed this Mar 3, 2024
@Bungeefan Bungeefan mentioned this pull request Mar 8, 2024
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