Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor Result class, remove asOk and asError #2542

Merged
merged 3 commits into from
Dec 5, 2024
Merged

Conversation

miquelbeltran
Copy link
Member

As discussed in the PR for the Result pattern implementation (flutter/website#11444) @parlough recommended that asError and asOk should be not be used, and instead we should use proper exhaustiveness checking.

This PR removes the two "convenience" methods and refactors code.

In some cases, it was enough with writing a proper if clause, while in others it was necessary to use a switch.

Still, they are present in the testing folder, as they can be useful for testing purposes.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-devrel channel on Discord.

Copy link
Contributor

@ericwindmill ericwindmill left a comment

Choose a reason for hiding this comment

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

Yes, this was a very good idea! Thank you @miquelbeltran and @parlough

@ericwindmill ericwindmill merged commit 57ecb5f into main Dec 5, 2024
13 checks passed
@ericwindmill ericwindmill deleted the mb-refactor-result branch December 5, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants