Skip to content

Rework url_launcher API #79043

@stuartmorgan-g

Description

@stuartmorgan-g

The url_launcher API has been added to piecemeal over time, and at this point is kind of a mess. Major issues:

  • People pass invalid URLs since it takes a String rather than a Uri; what happens to them is highly platform-specific.
  • There are separate iOS-specific and Android-specific options for whether to use an in-app web view or launch the browser:
    • It's likely that people will want the same behavior most of the time, making them awkward to use.
    • The default behavior for the two is different, and in fact the iOS flag has three modes, not two, since it has special handling of null, making it extremely confusing.
    • This doesn't scale to other platforms (all desktop platforms could have in-app pop-up windows or overlay views, for instance)
  • There's handling of iOS overlay brightness, which when it was added had to be done in the native plugin implementation code, but has since moved entirely into Dart, so doesn't need to be in the plugin at all since someone could easily write that wrapper themselves.

I think it's time to do a breaking change to the plugin that completely overhauls the API. My current proposal is https://github.com/stuartmorgan/plugins/blob/url-launcher-uri/packages/url_launcher/url_launcher/lib/url_launcher.dart, but I'll gather feedback and potentially iterated before moving forward. (Once I've settled on an API I'll do a change to the platform interface and the implementations first, so it's not shoehorning the new API into the old platform interface API.)

Metadata

Metadata

Labels

P3Issues that are less important to the Flutter projectp: url_launcherPlugin to launch external applicationspackageflutter/packages repository. See also p: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions