How oapmartins/pokedex_flutter_bloc works
Project Type and Purpose
• This is a mobile application built with Flutter (Dart) targeting both Android and iOS.
• It uses the BLoC pattern and Clean Architecture layers (presentation, domain, data) to fetch and display Pokémon data from an external JSON API.
File Structure
• Top-level mobile folders:
• android/ – native Android integration
• ios/ – native iOS integration
• Core app code under lib/:
• features/home/… – implements one feature module (“home”) following Clean Architecture:
– data/datasources (remote API client)
– data/models (JSON ↔ Dart models)
– data/repositories (concrete Repo implementation)
– domain/entities, domain/repositories (abstract interfaces), domain/usecases
– presentation/bloc (HomeBloc, events, states), pages & widgets
• main.dart – app entry point
• assets/ – fonts, images, SVGs for UI
• pubspec.yaml – dependencies (flutter_bloc, http, etc.)
Inspect the README
• Confirms external API endpoint (pokedex.json)
• References Figma UI spec
• No backend code; this app acts purely as a frontend consumer of a remote API
Main Components and Their Interactions
a. Components:
• Mobile Platforms (Android & iOS)
• Flutter Engine & Dart Runtime
• Presentation Layer
– UI Widgets (HomePage, PokemonDetailPage, filter chips, type badges)
– State Manager (HomeBloc)
• Domain Layer
– UseCase (FetchPokemonsUsecase)
– Entity (Pokemon)
• Data Layer
– Repository Impl (PokemonRepositoryImpl)
– Remote DataSource (PokemonRemoteDataSource)
– HTTP Client
• External Service
– PokeAPI JSON endpoint
• Assets & Config
– Fonts, images, constants
b. Interactions (flow of data):
1. User taps UI → UI Widget dispatches HomeEvent to HomeBloc
2. HomeBloc → invokes FetchPokemonsUsecase in the domain layer
3. UseCase → calls PokemonRepository (abstract)
4. RepositoryImpl → fetches data via PokemonRemoteDataSource (HTTP GET)
5. RemoteDataSource → HTTP Client issues request → receives JSON → maps to PokemonModel
6. RepositoryImpl → converts PokemonModel → Pokemon entity → returns to UseCase
7. UseCase → emits entity list → HomeBloc updates HomeState → UI rebuilds
c. Architectural Patterns & Principles:
• Clean Architecture separation: presentation ↔ domain ↔ data
• BLoC for state management and event-driven UI updates
• Dependency inversion: presentation depends on abstract usecases, data on abstract repositories
• Single responsibility: each layer has a narrow focus
d. Key Technologies:
• Flutter & Dart SDK
• flutter_bloc package
• http (or dio) for network requests
• JSON serialization in model classes
• Platform channels are only used for default Flutter engine integration (no custom native code here)