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

[path_provider] Completely rethink the path_provider API #118712

Open
stuartmorgan opened this issue Jan 18, 2023 · 0 comments
Open

[path_provider] Completely rethink the path_provider API #118712

stuartmorgan opened this issue Jan 18, 2023 · 0 comments
Labels
c: new feature Nothing broken; request for a new capability p: path_provider Plugin that provides resolved paths to some platform directories P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team

Comments

@stuartmorgan
Copy link
Contributor

stuartmorgan commented Jan 18, 2023

The API for path_provider has a number of significant issues:

  • It was design before federation existed, so platform-specific paths (like getExternalCacheDirectories, which is highly Android-specific in practice) are mixed in with abstractions in the app-facing API.
  • Some of the APIs were designed for Android APIs that have since been deprecated, and the underlying implementation changed, creating some confusing naming.
  • The APIs are almost all pre-desktop, so tend to be mobile-centric.
  • The desktop implementation of the documents directory (a widely-used API) is, essentially, wrong, and we can't fix it without a breaking change.

The package's API would benefit from being redesigned from scratch. We should:

  • Audit all of the existing APIs and open requests for new APIs.
  • Make a matrix of all the APIs that it makes sense to support, and what platforms they make sense on.
  • Decide what high-level abstractions we want core functionality for (in particular taking a look at the user-created vs. app-created-but-expensive vs app-created-and-easily purgeable, which we have as distinctions right now but in a somewhat platform-fragmented way, and not well named as abstractions).
  • Create a two-tiered API system, with common abstractions in path_provider and platform-specific things in path_provider_*, with clear docs in the app-facing package about the existence of the latter, with links to implementation package readmes as examples.

Removing APIs from path_provider would be extremely disruptive as it's such a foundational plugin in the package ecosystem, but we can deprecate the old APIs and create a clean set of new APIs, like we did with url_launcher. That way we don't have to do it as a breaking change, so everyone in the ecosystem can switch to the new APIs gradually, without creating a lot of transitive version conflict problems.

@stuartmorgan stuartmorgan added c: new feature Nothing broken; request for a new capability plugin p: path_provider Plugin that provides resolved paths to some platform directories P2 Important issues not at the top of the work list labels Jan 18, 2023
auto-submit bot pushed a commit to flutter/plugins that referenced this issue Jan 19, 2023
* [path_provider] Switch to `path_provider_foundation`

Switches to using the new combined `path_provider_foundation` for iOS
and macOS.

Also updates the code documentation to make it less Android and iOS
specific. The original goal was to make the documentation for
the download directory not be actively wrong for the new implementation,
but it seemed like a good time to fix 76427 more generally.
(The fact that the docs are kind of a mess because the API itself
is kind of a mess is now
flutter/flutter#118712.)

Fixes flutter/flutter#117941
Fixes flutter/flutter#76427

* Remove exclusion

* Update test expectations and README

* Update test expectations again, and update docs
mauricioluz pushed a commit to mauricioluz/plugins that referenced this issue Jan 26, 2023
* [path_provider] Switch to `path_provider_foundation`

Switches to using the new combined `path_provider_foundation` for iOS
and macOS.

Also updates the code documentation to make it less Android and iOS
specific. The original goal was to make the documentation for
the download directory not be actively wrong for the new implementation,
but it seemed like a good time to fix 76427 more generally.
(The fact that the docs are kind of a mess because the API itself
is kind of a mess is now
flutter/flutter#118712.)

Fixes flutter/flutter#117941
Fixes flutter/flutter#76427

* Remove exclusion

* Update test expectations and README

* Update test expectations again, and update docs
engine-flutter-autoroll pushed a commit to engine-flutter-autoroll/packages that referenced this issue Feb 22, 2023
* [path_provider] Switch to `path_provider_foundation`

Switches to using the new combined `path_provider_foundation` for iOS
and macOS.

Also updates the code documentation to make it less Android and iOS
specific. The original goal was to make the documentation for
the download directory not be actively wrong for the new implementation,
but it seemed like a good time to fix 76427 more generally.
(The fact that the docs are kind of a mess because the API itself
is kind of a mess is now
flutter/flutter#118712.)

Fixes flutter/flutter#117941
Fixes flutter/flutter#76427

* Remove exclusion

* Update test expectations and README

* Update test expectations again, and update docs
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
@Hixie Hixie removed the plugin label Jul 6, 2023
@flutter-triage-bot flutter-triage-bot bot added team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability p: path_provider Plugin that provides resolved paths to some platform directories P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team
Projects
None yet
Development

No branches or pull requests

2 participants