# 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
  1. Add to Existing Projects (Optional): Add the following to your pubspec.yaml:

    dependencies:
      flutter_hybrid_starter: ^1.0.0
    
  2. 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:

  1. Fork the Repository:

    • Click the "Fork" button on the top-right of this repository.
  2. Create a Feature Branch:

    git checkout -b feature/awesome-feature
    
  3. Commit Your Changes:

    git commit -m "Add awesome feature"
    
  4. Push to Your Fork:

    git push origin feature/awesome-feature
    
  5. 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! πŸš€