-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(share_plus): remove direct dependence of url_launcher #1295
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
feat(share_plus): remove direct dependence of url_launcher #1295
Conversation
Is this PR still in progress? |
Yes, I just need to fix some test. |
c2448c9
to
167c604
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea. I don't fully understand why it was a problem to have url_launcher as a dependency originally, but I like that now it is injected as param, easier to mock or replace even.
I will have to test on Monday before merging |
Someone wanted to save a few KBs in their app, so why not. |
Thanks! |
await urlLauncher.launchUrl(uri.toString(), const LaunchOptions()); | ||
} else { | ||
throw Exception('Unable to share on web'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: changing to this construction will break functionality, and has no advantages; see https://pub.dev/packages/url_launcher#checking-supported-schemes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it's better to have only launchUrl
in try catch block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking the return of launchUrl is better construct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it's better to have only
launchUrl
in try catch block?
I'm not sure what the goal of a try/catch would be given that you are currently throwing.
Checking the return of launchUrl is better construct?
If you don't have a specific need to know in advance of trying (which is rare, and certainly isn't the case given the code here), checking what actually happened is better than using a potentially inaccurate prediction of what might happen, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@miquelbeltran FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If anyone can send a PR with the fix, I can review and merge asap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I can do that.
Description
Remove direct dependence of url_launcher, instead depending on platform specific packages.
Related Issues
resolves #1070
Checklist
CHANGELOG.md
nor thepubspec.yaml
files.flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
!
in the title as explained in Conventional Commits).