ABCD Architecture is a starter Flutter project designed to help you kickstart your app development process with a clean, scalable architecture. This project leverages the Bloc pattern for managing app data, which can be used with any state management solution (Provider is used in this project).
- π API: Handles communication with external services.
- π§ Bloc: The brain of the application, responsible for managing data and state. It uses the
notifyListeners
method to trigger UI updates. - π Command: Represents user actions. Commands have access to all Blocs, allowing them to manage and update the state, which in turn updates the UI as needed.
- π Data: Custom data classes must be declared here. These can be implemented in the
FirebaseServiceExtension
orHiveServiceExtension
for saving data locally or in Firestore.
- π₯ Firebase: Integrated for backend services like Firestore, Firestorage, Authentication, etc.
- π¦ Hive: Used for local data storage.
- π³ In-App Purchases: Built-in support for handling in-app purchases.
- π Google Mobile Ads: Integrated for monetizing your app with ads.
There are two ways to use this project:
- Create a Flutter Project: Start by creating a new Flutter project in your preferred way.
- Replace Your
lib
Folder: Download this repository and replace thelib
folder of your Flutter project with the one from this repo. - Update
pubspec.yaml
: Replace the dependencies in yourpubspec.yaml
with those from this project to ensure all necessary packages are included. - Remove Unused Features: If you don't need certain features like Firebase, In-App Purchases, or Google Mobile Ads, feel free to remove the corresponding Bloc, services, and dependencies.
- Configure Firebase: If you're using Firebase, make sure to configure it by following the instructions on the Firebase website.
- Clone the Repository: Open your terminal and run the following command:
git clone https://github.com/SuTechs/abcd_architecture_flutter.git
- Navigate to the Project Directory:
cd abcd_architecture_flutter
- Get Dependencies: Run the following command to get all the required dependencies:
flutter pub get
- Configure Firebase: If you're using Firebase, configure it using FlutterFire CLI:
flutterfire configure
- Update Firebase Options: Open the file
lib/data/api/firebase/firebase_native.dart
and uncomment the Firebase options line:try { await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, );
- Run the Project: Finally, run the project using:
flutter run
Remember to customize the project according to your needs, removing any unnecessary features or dependencies.
To add or modify data handling, declare your custom data classes in the data
folder. Then, implement the necessary logic in FirebaseServiceExtension
or HiveServiceExtension
depending on whether you need to save data locally or in Firestore.
For screen management, define each screen separately in the screens
folder. Create components specific to that screen in a subfolder within the screenβs folder. If any component is shared by multiple screens, itβs a good idea to extract it into the widgets
folder for reusability.
Feel free to contribute to this project by opening issues or submitting pull requests. Your contributions are welcome!