-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[url_launcher] Convert macOS to Pigeon #3686
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
[url_launcher] Convert macOS to Pigeon #3686
Conversation
Replaces manual method channels with Pigeon. Adjusts the API to return a structured error for the known-failure case of a URL that can't be parsed, instead of returning a `FlutterError`, to prepare for a future conversion of that case into an `ArgumentError` rather than a `PlatformException`; using a strucutred error adds a bit of API complexity, but avoids the need to do a catch/throw-or-rethrow using string matching across the language boundary. Part of flutter/flutter#117915
/// Possible error conditions for [UrlLauncherApi] calls. | ||
enum UrlLauncherError { | ||
/// The URL could not be parsed as an NSURL. | ||
invalidUrl, |
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 did this as an enum even though there's only one value since it was more self-documenting this way, and would easily extend to other error cases if we find more in the future.
this is just a pigeon change right? not a full conversion to swift? |
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.
lgtm, with version updates
I have no idea why I wrote Swift in the title; it's already a Swift plugin. |
[url_launcher] Convert macOS to Pigeon
Replaces manual method channels with Pigeon. Adjusts the API to return a structured error for the known-failure case of a URL that can't be parsed, instead of returning a
FlutterError
, to prepare for a future conversion of that case into anArgumentError
rather than aPlatformException
; using a structured error adds a bit of API complexity, but avoids the need to do a catch/throw-or-rethrow using string matching across the language boundary.Part of flutter/flutter#117915
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).