Enhancing Codebase: A New Modular Structure - #21
Open
Meenapintu wants to merge 4 commits into
Open
Conversation
Meenapintu
marked this pull request as ready for review
July 4, 2025 15:47
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.
I've significantly improved our project's architecture by modularizing the codebase into two distinct packages. This separation allows for clearer responsibilities and greater flexibility.
What's Changed?
playing_cards_lib(Server-side): This new package (https://github.com/yehigo/playing_cards_lib) now exclusively houses the core logic and functionality of our playing card system. Importantly, withinplaying_cards_lib, theplaying_cards_lib,Suit, andCardValuemodels are now SerializableModel instances. This means they can be easily created from JSON and serialized to JSON, enhancing data exchange capabilities.playing_cards(Client-side): The originalplaying_cardspackage (https://github.com/bedardjo/playing_cards) is now dedicated solely to the user interface and experience.Why the Split?
The primary driver for this refactor was to eliminate an unnecessary Flutter SDK dependency from our backend. Previously, including the
playing_cardspackage directly in the server-side code meant pulling in Flutter's SDK, which significantly increased our backend bundle size. By isolating the core logic intoplaying_cards_lib, I've achieved a smaller, more efficient backend and improved overall maintainability.The Benefits
This modular approach brings several key advantages:
playing_cards_libcan be easily integrated into other projects or contexts without the overhead of UI dependencies, and its serialization capabilities make it ideal for various data handling scenarios.Backward Compatibility: Will This Break Existing Integrations?
No, this change will not break existing codebases for current users.
I understand the importance of a seamless transition. For this reason, I've exported
playing_cards_libwithinlib/playing_cards.dartof theplaying_cardspackage. This means that any existing projects that importplaying_cardswill continue to function without disruption. While the best practice is to directly importplaying_cards_libfor core functionality, I've prioritized backward compatibility for this update. In future versions, we might introduce deprecation warnings to guide users toward directly importingplaying_cards_lib.