Hosting Packages for Customization
To enable customization of the Flutter News App Toolkit, you must host your own version of the shared packages. The applications (Mobile Client, Web Dashboard) are designed to be customized, but the deepest and most impactful changes—like altering data models or redesigning the UI theme—happen within the shared packages.
This guide will walk you through the essential process of creating a private copy of a shared package from the original public repository.
Why You Must Host a Private Copy
Section titled “Why You Must Host a Private Copy”- To Enable Modification: You cannot push changes to the original public repositories. To modify a package, you need your own version that you control.
- For Privacy and Control: Hosting the packages in your own private repositories ensures that your proprietary changes, business logic, and customizations remain confidential.
- To Manage Updates: It gives you full control over when and how you pull in future updates from the original toolkit.
The Workflow: A Step-by-Step Guide
Section titled “The Workflow: A Step-by-Step Guide”Let’s walk through the process using the core
package as an example. You will repeat these steps for any other package you wish to customize, such as ui_kit
or data_repository
.
-
Clone the Original Package Repository
First, clone the package’s repository from the public GitHub organization to your local machine. Make sure you are not inside another Git repository when you do this.
Terminal window # Clone the 'core' package repositorygit clone https://github.com/flutter-news-app-full-source-code/core.git# Navigate into the newly cloned directorycd core -
Create a New Private Repository on GitHub
Go to your GitHub account and create a new private repository.
- Name it appropriately (e.g.,
my-company-core-package
). - Do not initialize it with a README, .gitignore, or license file, as we will be pushing an existing repository.
- Name it appropriately (e.g.,
-
Update the Git Remote URL
Back in your terminal, inside the
core
directory you cloned, you need to change the Git “remote” from the original public repository to your new private one.First, view the existing remote:
Terminal window git remote -v# origin https://github.com/flutter-news-app-full-source-code/core.git (fetch)# origin https://github.com/flutter-news-app-full-source-code/core.git (push)Now, change the URL to point to your new private repository:
Terminal window git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_NEW_PRIVATE_REPO_NAME.gitReplace
YOUR_USERNAME
andYOUR_NEW_PRIVATE_REPO_NAME
with your actual GitHub details. -
Push the Code to Your Private Repository
Finally, push the package code to your new private repository.
Terminal window git push -u origin --allgit push -u origin --tags
You have now successfully created a private copy of the core
package. It is now hosted in your private repository, ready for any modifications you need to make.
The next step is to tell your applications (Mobile Client, Web Dashboard) to use your version of the package instead of the original one. The next guide, Guide: Customizing the UI Theme, will walk you through this process in a practical, hands-on example.