SIGN IN SIGN UP

[flutter_tools] migrate getBuildInfo() to typed OptionDescriptors and BuildInfoOptionsBundle (#191510)

Second step in the type-safe, declarative CLI argument refactor for
`flutter_tools` (following
[flutter/flutter#191018](https://github.com/flutter/flutter/pull/191018)).

This PR migrates `getBuildInfo()` in `FlutterCommand` to use typed
option descriptors and `SafeArgResults`, eliminating 21 defensive
string-based `argParser.options.containsKey('...')` queries.

### Key Changes

1. **`BuildInfoOptionsBundle`
(`lib/src/runner/options/common_options.dart`)**:
- Encapsulates options specific to `BuildInfo` creation
(`track-widget-creation`, `analyze-size`, `code-size-directory`,
`obfuscate`, `split-debug-info`, `android-gradle-daemon`,
`android-project-arg`, `android-project-cache-dir`,
`android-skip-build-dependency-validation`,
`performance-measurement-file`, `flavor`, `codesign`,
`frontend-server-starter-path`, `initialize-from-dill`,
`assume-initialize-from-dill-up-to-date`, `extra-front-end-options`,
`extra-gen-snapshot-options`).
- Grouped into declarative `const` option descriptors maintaining 100%
backward compatibility for names, abbreviations, aliases, help strings,
and defaults.

2. **`getBuildInfo()` Refactor
(`lib/src/runner/flutter_command.dart`)**:
- Replaced all 21 imperative string lookups with type-safe `wasParsed()`
/ `getValue()` calls via `SafeArgResults`.

3. **Testing & Verification**:
- Added unit test suite
`test/general.shard/runner/options/build_info_options_bundle_test.dart`
verifying all descriptors register properly.
   - `dart analyze` across `packages/flutter_tools`: **0 issues**.
- Runner and build unit tests (`flutter_command_test.dart`,
`build_test.dart`): **250/250 passing**.
K
Kevin Moore committed
ba57163c84ead057c385a4cd1bcf3ee39a97bf9b
Parent: 3700590
Committed by GitHub <noreply@github.com> on 8/25/2026, 6:45:54 PM