Skip to content

Hamza-Maa/Flutter-Starter-Template-With-Riverpod

Repository files navigation

Flutter Project Structure with Riverpod

This is a sample project structure for a Flutter application utilizing Riverpod for state management. The structure is designed to provide organization, scalability, and maintainability to your Flutter project.

Project Structure

lib/
|-- main.dart
|-- app/
|   |-- screens/
|   |   |-- home_screen.dart
|   |   |-- login_screen.dart
|   |   |-- account_screen.dart
|   |-- widgets/
|   |   |-- account_card.dart
|   |-- models/
|   |   |-- user.dart
|   |   |-- account.dart
|   |-- providers/
|   |   |-- user_provider.dart
|   |   |-- account_provider.dart
|   |-- services/
|   |   |-- authentication_service.dart
|   |   |-- account_service.dart
|   |-- main_app.dart
|-- theme/
|   |-- app_theme.dart
|-- utils/
|   |-- constants.dart

Explanation:

  • main.dart:

    • Entry point of the application.
  • app/:

    • Contains all application-specific logic.
  • app/screens/:

    • Contains individual screens of the application.
    • Each screen represents a specific UI component of the app.
  • app/widgets/:

    • Reusable UI components/widgets used across multiple screens.
  • app/models/:

    • Data models representing entities in the application.
    • Models are used to structure and manage data within the app.
  • app/providers/:

    • Riverpod providers for managing the application state.
    • Provides data to different parts of the application.
  • app/services/:

    • Services for handling external operations such as network requests, database interactions, etc.
    • Encapsulates functionality related to specific services.
  • app/main_app.dart:

    • Initializes the application, sets up Riverpod providers, and defines MaterialApp.
  • theme/:

    • Contains files related to the theme of the application.
    • Defines the visual appearance of the app.
  • utils/:

    • Contains utility/helper functions and constants used throughout the application.
    • Encapsulates commonly used functionalities and constants.

Usage:

  • Screens: Add new screens under app/screens/ directory. Each screen should be a separate Dart file representing a specific UI component.

  • Widgets: Create reusable UI components under app/widgets/ directory. These components can be shared and reused across multiple screens.

  • Models: Define data models under app/models/ directory. These models represent entities within the application and help manage data.

  • Providers: Implement Riverpod providers under app/providers/ directory. These providers manage the application state and provide data to different parts of the application.

  • Services: Develop external services under app/services/ directory. These services handle operations such as authentication, data fetching, etc., and encapsulate related functionality.

  • Main App: Configure the main application setup in app/main_app.dart. Set up Riverpod providers, define MaterialApp, and initialize the app.

  • Theme: Define the visual theme of the application in theme/app_theme.dart. Customize colors, typography, and other visual aspects of the app.

  • Utilities: Create utility/helper functions and constants in utils/ directory. These utilities encapsulate commonly used functionalities and constants used throughout the application.

Contributing:

Feel free to contribute to this project by adding new features, fixing bugs, or improving the project structure. Follow the guidelines mentioned in CONTRIBUTING.md for contribution.

License:

This project is licensed under the MIT License - see the LICENSE.md file for details.


This README.md provides an overview of the project structure, explaining the purpose of each directory and file. It also outlines how to use and contribute to the project. Adjustments can be made based on your specific project requirements and preferences.

About

Flutter Empty Template stater app with riverpod state management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published