Skip to content

About

Flutter Movie πŸ“± app built with Riverpod, GoRouter, Dio, and Freezed based on Clean Architecture. It offers a clean, scalable, and maintainable codebase for Flutter development

Topics

Resources

Stars

28 stars

Watchers

2 watching

Forks

Latest commit

Β 

History

76 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flutter Movie Clean Architecture

Flutter Dart Riverpod Localization badge-Android badge-iOS GitHub license GitHub

Flutter Movie App built with Riverpod, Clean Architecture, and GoRouter that showcases movies and TV series fetched from TMDB API. It includes now playing, popular, top-rated, and upcoming Movies, TV series and Celebrity with support for pagination, search, and detailed views.

✨ Features

Movies

  • 🎞 Now Playing, Popular, Top Rated & Upcoming movie sections (paginated)
  • πŸ” Movie Detail Pages with Cast & Crew
  • 🎯 Recommended Movies
  • πŸ” Search Movies (debounced)
  • πŸ‘€ Artist/Actor Detail Page with navigation from movie cast
  • ❀️ Favorite Movies (saved locally using Hive database)

TV Series

  • πŸ“Ί Airing Today, On The Air, Popular & Upcoming TV series sections (paginated)
  • πŸ” TV Series Detail Pages with Cast & Crew
  • 🎯 Recommended TV Series
  • πŸ” Search TV Series (debounced)
  • πŸ‘€ Artist/Actor Detail Page with navigation from TV series cast
  • ❀️ Favorite TV Series (saved locally using Hive database)

Celebrity

  • 🌟 Popular and Trending Celebrities/Persons sections (paginated)
  • πŸ” Celebrity Search functionality (debounced)
  • πŸ‘€ Celebrity Detail Page with navigation from movie/tv cast
  • ❀️ Favorite Celebrities (saved locally using Hive database)

Common Features

  • πŸ“ƒ Infinite Scroll Pagination across all list views
  • πŸ”„ Bottom Navigation with tab switching
  • 🌐 Multi-language Support with Localization (English & Spanish)
  • 🧭 Declarative Routing with GoRouter
  • 🧱 Clean Architecture (Presentation / Domain / Data) β€” no empty abstraction layers
  • πŸ§ͺ Riverpod State Management
  • 🌐 Network layer using Dio with Logging
  • πŸš€ Smooth UX with loading indicators and cached images
  • ❀️ Favorite Management with Local Storage (Hive)
  • 🎨 Dark/Light/System Theme Toggle (persisted)
  • πŸ” Unified Universal Search with debounced API calls

πŸ—οΈ Architecture

This project follows Clean Architecture principles with pragmatic simplifications:


Layers:

  • Presentation Layer: UI components (pages/widgets), state management (Riverpod providers)
  • Domain Layer: Business entities, repository interfaces
  • Data Layer: Remote data sources (Dio), local persistence (Hive), repository implementations, data models

Key Architectural Decisions:

  • No empty use case layer: Use cases that only delegate to repositories were removed. Providers call repositories directly. Use cases are only added when they contain actual business logic.
  • Shared entities: Duplicate Cast/Crew classes across features merged into core/entities/credit_entity.dart.
  • Shared widgets: MediaCard, DescriptionSection, RecommendationsSection, CreditsSection reused across movie and TV series features.
  • Favorites as a proper feature: Favorites provider and model moved from core/hive/ and movie/ into features/favorites/ with proper Clean Architecture layers.

πŸ“ Project Structure

flutter_movie_clean_architecture/
β”œβ”€β”€ .env                                    # TMDB API key (gitignored)
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ main.dart
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   └── app_constant.dart           # URLs, reads apiKey from .env
β”‚   β”‚   β”œβ”€β”€ entities/
β”‚   β”‚   β”‚   └── credit_entity.dart          # Shared Cast/Crew entities
β”‚   β”‚   β”œβ”€β”€ hive/
β”‚   β”‚   β”‚   └── hive_helper.dart            # Hive initialization
β”‚   β”‚   β”œβ”€β”€ localization/
β”‚   β”‚   β”‚   β”œβ”€β”€ app_localizations.dart
β”‚   β”‚   β”‚   └── localization_helper.dart
β”‚   β”‚   β”œβ”€β”€ network/
β”‚   β”‚   β”‚   └── dio_provider.dart           # Dio HTTP client
β”‚   β”‚   β”œβ”€β”€ theme/
β”‚   β”‚   β”‚   β”œβ”€β”€ app_theme.dart
β”‚   β”‚   β”‚   β”œβ”€β”€ theme_providers.dart        # ThemeModeNotifier (direct Hive)
β”‚   β”‚   β”‚   └── theme_toggle_widget.dart
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”‚   β”œβ”€β”€ pagination_consumer_state.dart  # Reusable pagination logic
β”‚   β”‚   β”‚   └── utils.dart
β”‚   β”‚   └── widgets/
β”‚   β”‚       β”œβ”€β”€ media_card.dart             # Unified card for movie/tv/person
β”‚   β”‚       └── detail_sections.dart        # Shared Description/Recommendations/Credits
β”‚   β”œβ”€β”€ routing/
β”‚   β”‚   └── app_router.dart
β”‚   β”œβ”€β”€ presentation/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   └── main_tab_page.dart
β”‚   β”‚   └── widgets/
β”‚   β”‚       └── universal_search.dart       # Debounced universal search
β”‚   └── features/
β”‚       β”œβ”€β”€ celebrity/
β”‚       β”‚   β”œβ”€β”€ data/
β”‚       β”‚   β”‚   β”œβ”€β”€ datasources/
β”‚       β”‚   β”‚   β”œβ”€β”€ models/
β”‚       β”‚   β”‚   └── repositories/
β”‚       β”‚   β”œβ”€β”€ domain/
β”‚       β”‚   β”‚   β”œβ”€β”€ entities/
β”‚       β”‚   β”‚   └── repositories/
β”‚       β”‚   └── presentation/
β”‚       β”‚       β”œβ”€β”€ pages/
β”‚       β”‚       └── providers/
β”‚       β”œβ”€β”€ favorites/                      # Proper Clean Architecture layers
β”‚       β”‚   β”œβ”€β”€ data/models/
β”‚       β”‚   β”‚   β”œβ”€β”€ favorite_model.dart
β”‚       β”‚   β”‚   └── favorite_model.g.dart
β”‚       β”‚   β”œβ”€β”€ presentation/providers/
β”‚       β”‚   β”‚   └── favorite_provider.dart  # Single favorites StateNotifier
β”‚       β”‚   └── favorites_page.dart
β”‚       β”œβ”€β”€ movie/
β”‚       β”‚   β”œβ”€β”€ data/
β”‚       β”‚   β”‚   β”œβ”€β”€ datasources/
β”‚       β”‚   β”‚   β”œβ”€β”€ models/
β”‚       β”‚   β”‚   └── repositories/
β”‚       β”‚   β”œβ”€β”€ domain/
β”‚       β”‚   β”‚   β”œβ”€β”€ entities/
β”‚       β”‚   β”‚   └── repositories/
β”‚       β”‚   └── presentation/
β”‚       β”‚       β”œβ”€β”€ pages/
β”‚       β”‚       β”‚   β”œβ”€β”€ movie_main_page.dart
β”‚       β”‚       β”‚   β”œβ”€β”€ movie_detail_page.dart
β”‚       β”‚       β”‚   β”œβ”€β”€ artist_detail_page.dart
β”‚       β”‚       β”‚   β”œβ”€β”€ now_playing_page.dart    # Paginated
β”‚       β”‚       β”‚   β”œβ”€β”€ popular_page.dart        # Paginated
β”‚       β”‚       β”‚   β”œβ”€β”€ top_rated_page.dart
β”‚       β”‚       β”‚   └── upcoming_movies_page.dart
β”‚       β”‚       └── providers/
β”‚       β”‚           └── movie_provider.dart
β”‚       └── tv_series/
β”‚           β”œβ”€β”€ data/
β”‚           β”œβ”€β”€ domain/
β”‚           └── presentation/
β”‚               β”œβ”€β”€ pages/
β”‚               └── providers/
β”œβ”€β”€ test/
β”œβ”€β”€ pubspec.yaml
β”œβ”€β”€ analysis_options.yaml
β”œβ”€β”€ .env
└── .gitignore

πŸš€ Getting Started

Prerequisites

Installation

  1. Clone the repository:
git clone git@github.com:piashcse/flutter-movie-clean-architecture.git
cd flutter-movie-clean-architecture
  1. Set up environment variables:
# Edit .env and add your TMDB API key
TMDB_API_KEY=your_api_key_here
  1. Install dependencies:
flutter pub get
  1. Generate code (build runner):
flutter pub run build_runner build --delete-conflicting-outputs
  1. Run the app:
flutter run

πŸ› οΈ Built With

πŸ‘¨β€πŸ’» Developed By

Mehedi Hassan Piash

Twitter Medium Linkedin Web Blog

πŸ“„ License

Copyright 2025 piashcse (Mehedi Hassan Piash)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Flutter Movie πŸ“± app built with Riverpod, GoRouter, Dio, and Freezed based on Clean Architecture. It offers a clean, scalable, and maintainable codebase for Flutter development

Topics

Resources

Stars

28 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages