Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors sealed classes across the project to use private implementation classes (prefixed with _) generated by freezed and replaces pattern matching with switch statements with the .when() and .maybeWhen() methods. Additionally, it adds error handling to event classes to ensure errors are properly handled when copying features.
Changes:
- Replaced public freezed implementation class names (e.g.,
ProfileEventSignedOut) with private ones (e.g.,_SignedOut) - Converted switch-based pattern matching to
.when(),.maybeWhen(), and.whenOrNull()methods - Added error event variants to authentication, profile, and debug tools event classes
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/features/profile/profile_page.dart | Updated event listener to use .when() method and added error handling |
| lib/features/profile/profile_event.dart | Changed to private implementation classes and added error event |
| lib/features/debug_tools/page/widgets/debug_tools_widgets_page_event.dart | Changed to private implementation classes and added error event |
| lib/features/debug_tools/page/widgets/debug_tools_widgets_page_content.dart | Updated event listener to use .when() method and added error handling |
| lib/features/authentication/authentication_state.dart | Replaced switch pattern with .maybeWhen() for exception handling |
| lib/features/authentication/authentication_page.dart | Updated event listener to use .when() method and added error handling |
| lib/features/authentication/authentication_event.dart | Changed to private implementation classes and added error event |
| lib/core/analytics/analytics_screen_view.dart | Simplified to use private classes with default parameter values |
| lib/common/validator/text_field_validator_state.dart | Changed to private classes and replaced getters/methods with .when() variants |
| lib/common/validator/controller/text_validator_controller_general.dart | Simplified to use state's isValid getter directly |
| lib/common/usecase/authentication/sign_in_with_auth_credential_use_case.dart | Replaced switch pattern with .whenOrNull() |
| lib/common/provider/notifications_service.dart | Replaced switch statements with .when() method |
| lib/common/data/entity/notification_payload_entity.dart | Simplified to private classes, removed default values from unknown variant |
| lib/common/data/entity/exception/validator_exception.dart | Refactored to use shared getText field and simplified getMessage |
| lib/common/data/entity/exception/custom_exception.dart | Changed to private classes and replaced switch with .maybeWhen() |
| README.md | Removed completed TODO item about sealed classes refactor |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Refactored sealed classes in the project to keep them consistent. Used generated classes from freezed and then using
.wheninstead ofswitch.Added errors as part of the event classes to not forget about the error handling during copying features.