🌟 We are Open Source! Check out our repository on GitHub

Flutter Project Structure

A scalable and maintainable folder structure for Flutter applications

File Structure

  • lib
    • main.dart
    • core
      • constants
      • errors
      • network
      • usecases
    • features
      • authentication
        • data
        • domain
        • presentation
      • home
        • data
        • domain
        • presentation
    • shared
      • widgets
      • utils
      • themes
  • assets
    • images
    • fonts
    • icons
    • animations
  • test
    • unit
    • widget
    • integration
  • pubspec.yaml
  • analysis_options.yaml
  • flutter_launcher_icons.yaml
  • README.md

Directory Structure Explanation

lib/core/

Contains core functionality and infrastructure code used across the entire application.

core/constants/

App-wide constants including API endpoints, colors, and configuration values.

core/errors/

Error handling classes and custom exceptions for consistent error management.

core/network/

Network layer implementation including HTTP clients and API configuration.

lib/features/

Feature-based organization following Clean Architecture principles.

features/authentication/

Complete authentication feature including data, domain, and presentation layers.

authentication/data/

Data layer containing repositories, data sources, and models for authentication.

authentication/domain/

Domain layer containing entities, use cases, and repository interfaces.

authentication/presentation/

Presentation layer containing screens, widgets, and state management for authentication.

lib/shared/

Shared components and utilities used across multiple features.

shared/widgets/

Reusable widgets that can be used across different features and screens.

shared/themes/

Theme configuration including colors, typography, and styling definitions.

test/

Contains all test files organized by test type (unit, widget, integration).

flutter_launcher_icons.yaml

Configuration file for generating app icons for different platforms.