Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simplify QueryFilter.parse#9072

Merged
srawlins merged 2 commits intoflutter:masterfrom
srawlins:simplify-query-filter
Mar 27, 2025
Merged

Simplify QueryFilter.parse#9072
srawlins merged 2 commits intoflutter:masterfrom
srawlins:simplify-query-filter

Conversation

@srawlins
Copy link
Contributor

The cyclomatic complexity here was quite high. We can remove two nested layers of 'if's with short circuit returns. Also:

  • QueryFilter._'s first two parameters are always given, so just make them required.

@srawlins srawlins requested a review from a team as a code owner March 27, 2025 02:43
@srawlins srawlins requested review from elliette and removed request for a team March 27, 2025 02:43
Comment on lines +496 to +497
arg.isNegative = part.startsWith(QueryFilterArgument.negativePrefix);
arg.values =
Copy link
Member

Choose a reason for hiding this comment

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

nit: use cascades

arg
  ..isNegative = ...
  ..values = ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@srawlins srawlins merged commit 367b770 into flutter:master Mar 27, 2025
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants