Repository navigation
[flutter_tools] refactor wasm dry-run result handling in Dart2WasmTarget - #190891
Merged
auto-submit[bot] merged 4 commits intoAug 14, 2026
Merged
Conversation
Reduce cognitive complexity in Dart2WasmTarget._handleDryRunResult by decomposing the monolithic routine into focused helper methods: * Add _DryRunOutcome enum and _logAndClassifyDryRunResult to cleanly map exit codes and process streams to execution outcomes. * Extract _collectFindingsInfo and _parseWasmFindings for stdout error code and URI parsing. * Extract _categorizePackages to partition hosted vs. private package configurations from PackageConfig. * Extract _classifyUris and _truncateAnalyticsBuffer to handle analytics finding truncation and hint formatting. * Drops cognitive complexity score of _handleDryRunResult from 48 to 4.
…in web.dart Specify explicit types for destructured record variables in _formatFindingsBuffer to satisfy repo-wide specify_nonobvious_local_variable_types lint.
kevmoo
marked this pull request as ready for review
August 11, 2026 02:25
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the Dart2WasmTarget class in web.dart by extracting several helper methods to improve modularity and readability. The review feedback highlights two improvement opportunities: guarding URI path segment access in _classifyUris to prevent potential StateError exceptions, and optimizing _parseWasmFindings by instantiating the RegExp outside of the loop.
* Hoist _wasmErrorCodePattern to static field in Dart2WasmTarget and defer Uri.parse in _parseWasmFindings until errorCode is non-null. * Guard uri.pathSegments access in _classifyUris with uri.scheme == 'package' && uri.pathSegments.isNotEmpty.
harryterkelsen
requested changes
Aug 11, 2026
- Document _DryRunOutcome values with classification rules and sample input - Add doc comments to all new dry-run helper functions - Add stdout:/stderr: headers when logging crash/failure output - Make logger and _collectFindingsInfo params required named - Use (false, false) => '' in exhaustive hint switch; drop nullable hpHint - Use containsKey/contains consistently in _classifyUris - Restore the shuffle rationale comment truncated in flutter#179826
This was referenced Aug 15, 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.
Reduce cognitive complexity in
Dart2WasmTarget._handleDryRunResultby decomposing the monolithic routine into focused helper methods:_DryRunOutcomeenum and_logAndClassifyDryRunResultto cleanly map exit codes and process streams to execution outcomes._collectFindingsInfoand_parseWasmFindingsfor stdout error code and URI parsing._categorizePackagesto partition hosted vs. private package configurations fromPackageConfig._classifyUrisand_truncateAnalyticsBufferto handle analytics finding truncation and hint formatting._handleDryRunResultfrom 48 to 4.Pre-launch Checklist
///).