Repository navigation
[flutter_tools] Move plugin validation out of asserts - #191359
Merged
auto-submit[bot] merged 2 commits intoAug 19, 2026
Merged
Conversation
Platform plugin `fromYaml` factories were performing validation inside `assert` statements. These are stripped in release mode, leaving the factories without validation for users. Replace the asserts with explicit checks that throw `ToolExit`.
…ation errors Include the plugin `$name` in the `ToolExit` error message when validating `fromYaml` in `AndroidPlugin`, `IOSPlugin`, `MacOSPlugin`, `WindowsPlugin`, and `LinuxPlugin`.
bkonyi
marked this pull request as ready for review
August 19, 2026 17:07
Contributor
There was a problem hiding this comment.
Code Review
This pull request replaces assertions with explicit validation checks in the fromYaml factories of AndroidPlugin, IOSPlugin, MacOSPlugin, WindowsPlugin, and LinuxPlugin, throwing a ToolExit with a descriptive error message when validation fails. Corresponding unit tests have been added to verify this validation behavior across all supported platforms. There are no review comments, and I have no feedback to provide.
dcharkes
approved these changes
Aug 19, 2026
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Platform plugin
fromYamlfactories inplatform_plugins.dart(AndroidPlugin,IOSPlugin,MacOSPlugin,WindowsPlugin, andLinuxPlugin) previously performed validation insideassertstatements. When Flutter tools runs in release mode (assertions disabled), calling these factories directly could bypass validation and return invalid plugin instances rather than surfacing a clean tool exit.This PR:
assert(validate(yaml))in all platform pluginfromYamlfactories with explicit validation checks that callthrowToolExit.Invalid "android" plugin specification for plugin "$name".).plugins_test.dartverifying thatfromYamlthrowsToolExitwhen passed invalid YAML.Fixes #67241
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.