flutter_hybrid_starter 1.0.2
flutter_hybrid_starter: ^1.0.2 copied to clipboard
A Flutter starter template with Hybrid Architecture, MVVM, and Riverpod.
# Flutter Hybrid Starter
A Flutter starter template with **Hybrid Architecture**, **MVVM**, and **Riverpod** for building scalable and maintainable apps.
---
## π Introduction
The **Flutter Hybrid Starter** provides a ready-to-use template combining:
- **Hybrid Architecture**: Blends feature-first and layer-first approaches.
- **MVVM Pattern**: Clean separation of UI and business logic.
- **Riverpod**: For state management and dependency injection.
- **Modular Structure**: Organized for scalability and maintainability.
Ideal for projects of any size, this template accelerates development while maintaining clean architecture.
---
## β¨ Features
- π **Hybrid Architecture**: Combines feature-first and layer-first approaches for scalability and maintainability.
- π§© **MVVM Pattern**: Separates UI logic from business logic using the Model-View-ViewModel pattern.
- π **Riverpod State Management**: Provides flexible and testable state management.
- π **Dependency Injection**: Uses Riverpod providers for dependency injection.
- π¦ **Modular Folder Structure**: Organized by features for better scalability.
- π **Example App**: Includes a working example to demonstrate usage.
---
## π Installation
1. **Clone the Repository**:
```bash
git clone https://github.com/AbuBakarPial/flutter_hybrid_starter.git
-
Add to Existing Projects (Optional): Add the following to your
pubspec.yaml
:dependencies: flutter_hybrid_starter: ^1.0.0
-
Run the Project:
flutter pub get flutter run
π Usage Example #
Hereβs how to use the UserScreen
in your app:
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_hybrid_starter/src/features/example_feature/presentation/screens/user_screen.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Hybrid Starter',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const UserScreen(),
);
}
}
This example demonstrates how to integrate the UserScreen
from the example_feature
module into your app. The UserScreen
is part of the modular structure and uses Riverpod for state management.
π Project Structure #
The project follows a modular and hybrid architecture with a clear separation of concerns. Here's the folder structure:
lib/
βββ src/
β βββ features/
β β βββ auth/ # Example feature: Authentication
β β β βββ data/ # Data sources, models, and repositories
β β β βββ domain/ # Business logic and use cases
β β β βββ presentation/ # UI components and screens
β β β βββ di/ # Dependency injection setup for the feature
β β βββ home/ # Example feature: Home
β β βββ data/ # Data sources, models, and repositories
β β βββ domain/ # Business logic and use cases
β β βββ presentation/ # UI components and screens
β β βββ di/ # Dependency injection setup for the feature
β βββ core/
β β βββ entities/ # Shared domain entities
β β βββ use_cases/ # Shared use cases across features
β β βββ repositories/ # Abstract repository interfaces
β β βββ exceptions/ # Custom exceptions and error handling
β βββ data/
β β βββ datasources/ # Remote and local data sources
β β βββ models/ # Data models
β β βββ repositories/ # Concrete repository implementations
β βββ di/
β β βββ injector.dart # Global dependency injection setup
β βββ utils/ # Utility functions and helpers
βββ app.dart # Main app entry point
βββ main.dart # App initialization
This structure ensures that each feature is self-contained and easy to maintain, while still allowing shared components to live in the core
directory.
π₯ Contributing #
We welcome contributions! To contribute:
-
Fork the Repository:
- Click the "Fork" button on the top-right of this repository.
-
Create a Feature Branch:
git checkout -b feature/awesome-feature
-
Commit Your Changes:
git commit -m "Add awesome feature"
-
Push to Your Fork:
git push origin feature/awesome-feature
-
Open a Pull Request:
- Go to the original repository and click "New Pull Request".
- Describe your changes and submit the PR.
Please follow Dart's Effective Dart guidelines for code style and best practices.
π License #
This project is licensed under the MIT License. See the LICENSE file for details.
π Acknowledgments #
- Inspired by clean architecture and scalable Flutter app design principles.
- Built with β€οΈ using Flutter and Riverpod.
π’ Feedback and Support #
If you encounter any issues or have suggestions for improvement, please open an issue in the repository. We appreciate your feedback!
Happy coding! π