Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/flutter_tools/lib/src/flutter_plugins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ Map<String, List<Plugin>> _resolvePluginImplementations(
}
} else {
globals.printWarning(
'Package ${plugin.name}:$platformKey references $defaultImplPluginName:$platformKey as the default plugin, but the package does not exist.\n'
'Package ${plugin.name}:$platformKey references $defaultImplPluginName:$platformKey as the default plugin, but the package does not exist, or is not a plugin package.\n'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this may also be slightly wrong. Is this check based on post-platform-filtering, or pre-platform-filtering? I.e., if $defaultImplPluginName exists, and is a plugin package, but does not have a flutter:plugin:platforms: entry for platformKey, will we still hit this codepath?

If so, we need to rephrase to "or is not a plugin package that provides a $platformKey implementation."

Copy link
Contributor Author

@Gustl22 Gustl22 Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan
This check involves all plugins, which have this condition. So it's pre-platform-filtering. Means, all with the flutter: plugin: in the pubspec are considered. So I think the error message is correct that way.

We test the specific platform implementation a few lines above, which should cover your mentioned case (if I understood your concern right): https://github.com/flutter/flutter/pull/152134/files#diff-68361f6fc9aafa5fa7de042eec4603dd4f321eb783a00edd57780ef78c1094bbR1259

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks. Ideally the check should be stricter and require a platform implementation, but we can revisit that if it ever actually matters in practice.

'Ask the maintainers of ${plugin.name} to either avoid referencing a default implementation via `platforms: $platformKey: default_package: $defaultImplPluginName` '
'or create a plugin named $defaultImplPluginName.\n',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also change this to "or ensure that $defaultImplPluginNameis an existing plugin package that specifies aplatformKey` implementation."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the other comment.

);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ void main() {
expect(
testLogger.warningText,
'Package url_launcher:linux references url_launcher_linux:linux as the default plugin, '
'but the package does not exist.\n'
'but the package does not exist, or is not a plugin package.\n'
'Ask the maintainers of url_launcher to either avoid referencing a default implementation via `platforms: linux: default_package: url_launcher_linux` '
'or create a plugin named url_launcher_linux.\n'
'\n');
Expand Down