-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Decide how to handle Dart plugin registration for direct implementation dependencies #99083
Comments
I just ran into a variant of this, which I feel is slightly more confusing than the rules set out above. Consider the following packages:
The idea would be to have all
Personally, I missed that this really only refers to direct dependencies of a top-level application and packages depending on (non-endorsed) plugin implementations are not supported. This could probably be emphasized more, but there's something else: As this issue confirms, this only applies to the dart portion of plugins. The Only when I try to use So implementing 2. as proposed would make things even more confusing for non-endorsed plugins: If I transitively depend only on Some actionable ideas, that might help directing developers in the right direction:
|
It is unintentional in that we haven't yet extended the resolution system back to the existing native registration system. That is the intent, at which point the behaviors will be consistent.
This seems reasonable; I agree that the use case you described should work as you expected that it would, and I don't see any issues with enabling that approach. I suspect that the focus on direct dependencies (other than for conflict resolution) in the original design document was just an oversight. |
Fixes issues related to transitive dependencies on plugins with Dart implementations: - Ensures that if there are multiple transitive dependencies including the app-facing-package-selected default, the default is picked. Previously it was order-dependent what would happen, and in some cases no implementation would be picked. - Allows registration of a package's implementation even if the app-facing package is not present, as long as there is only one possible implementation (or the app directly picks one). There are cases where depending on just a platform implementation of a package, rather than the app-facing package, is useful. (E.g., shared_preferences_linux depends directly on path_provider_linux.) Also fixes a bug where an implementation conflict error was being gated behind a flag that was only supposed to be hiding an (overly-strict at the moment) error about plugin pubspec definitions. Fixes flutter#99083 Fixes flutter#118401
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Dart plugin registration uses the implementing-package resolution system described in the federated plugin design doc to figure out which plugins to run Dart registration for. At a high level the rules are:
This works well for normal federated plugin usage. We recently ran into an edge case, which is that sometimes a package might depend only on a specific platform implementation. For example:
shared_preference_windows
depends directly onpath_provider_windows
(but notpath_provider
), because we need the functionality to implementshared_preferences_windows
, but we wouldn't want to cause, say, the Android and iOS apps of anything usingshared_preferences
to unnecessarily include thepath_provider
code for those platforms. In this case:so Dart registration doesn't run for
path_provider_windows
. This is fine if we usePathProviderWindows
directly (which we do), but breaks if we try to usePathProviderPlatform.instance
(which is the equivalent of what the PR above did) for reasons that are probably not at all clear to anyone hit by it.We have a few options here:
I'm leaning toward thinking we should do some form of 2 since I would expect the case where two different packages pick two different implementation packages for the same platform to be very rare, so 2 should give surprising behavior less often.
The text was updated successfully, but these errors were encountered: