[flutter_tools] Move plugin validation out of asserts (#191359)
## Description Platform plugin `fromYaml` factories in `platform_plugins.dart` (`AndroidPlugin`, `IOSPlugin`, `MacOSPlugin`, `WindowsPlugin`, and `LinuxPlugin`) previously performed validation inside `assert` statements. 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: 1. Replaces `assert(validate(yaml))` in all platform plugin `fromYaml` factories with explicit validation checks that call `throwToolExit`. 2. Includes the plugin name in the exit error message (e.g. `Invalid "android" plugin specification for plugin "$name".`). 3. Adds automated unit tests in `plugins_test.dart` verifying that `fromYaml` throws `ToolExit` when passed invalid YAML. Fixes https://github.com/flutter/flutter/issues/67241 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to provide]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to provide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-provide [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://discord.gg/flutterdev [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
B
Ben Konyi committed
b01f2f4f46e5a3e96d0bd3be24d3a2475fe3e0ca
Parent: 9204165
Committed by GitHub <noreply@github.com>
on 8/19/2026, 8:49:08 PM