A comprehensive Flutter architecture showcase demonstrating top development practices, multiple state management patterns, and production-ready features.
This repository demonstrates:
- Clean Architecture implementation
- Multiple design patterns (Repository, Factory, Observer)
- SOLID principles adherence
- Separation of concerns
- BLoC pattern for complex flows (Authentication, Onboarding)
- Riverpod for modern reactive programming (Dashboard)
- Provider for traditional state management (Profile)
- Comprehensive error handling and logging
- Security best practices (secure storage, token management)
- Performance optimization (lazy loading, caching, memory management)
- Accessibility compliance (screen readers, contrast, focus management)
- Material Design 3 implementation
- Responsive design for all platforms
- Dark/light theme support
- Internationalization ready
See the app in action: Onboarding flow β’ Authentication flow β’ Dashboard features β’ Profile management β’ Real-time updates β’ Responsive design
DevHub is a developer portfolio and social platform built to demonstrate advanced Flutter architecture patterns and best practices. This project serves as a comprehensive showcase of modern Flutter development, featuring multiple state management solutions, clean architecture, and production-ready features.
- Modular Feature-Based Structure - Each feature is self-contained and independently maintainable
- Multiple Architecture Patterns - Clean Architecture, MVVM, Repository Pattern
- Multiple State Management - BLoC, Riverpod, Provider (comparative implementation)
- Dependency Injection - Using GetIt and Injectable for proper dependency management
- Advanced Routing - Modular routing system with AutoRoute
- Production-Ready Features - Authentication, offline support, performance optimization
- Real-World Complexity - Complex UI, data visualization, real-time features
- Interactive onboarding flow with animations
- Page indicators and navigation controls
- Skip functionality for returning users
- Animated backgrounds and smooth transitions
- Completion tracking with local storage
- Seamless navigation to authentication
- Email/Password authentication
- Social login (Google, GitHub) (in-progress)
- Biometric authentication (in-progress)
- Password reset functionality (in-progress)
- JWT token management with auto-refresh (in-progress)
- Real-time developer statistics
- Activity feed with infinite scroll
- Performance metrics visualization
- Offline-first architecture with sync
- Profile management and editing
- Skills and achievements system
- GitHub integration for stats
- Image upload and caching (in-progress)
lib/
βββ app/ # Application layer
β βββ pages/ # App-level pages
β
βββ core/ # Core functionality
β βββ constants/ # App constants
β βββ data/ # Core data layer
β βββ domain/ # Core domain layer
β βββ network/ # Network configuration
β βββ routing/ # Routing infrastructure
β βββ services/ # Core services (interfaces)
β βββ theme/ # App theming
β βββ utils/ # Utilities
β
βββ features/ # Feature modules
β βββ onboarding/ # Onboarding feature
β β βββ domain/ # Business logic
β β β βββ entities/ # Business objects
β β β βββ repositories/ # Repository interfaces
β β β βββ usecases/ # Business rules
β β βββ data/ # Data layer
β β β βββ datasources/ # Remote/Local sources
β β β βββ models/ # Data models
β β β βββ repositories/ # Repository implementations
β β βββ presentation/ # UI layer
β β β βββ bloc/ # State management
β β β βββ pages/ # Screen widgets
β β β βββ widgets/ # Reusable widgets
β β β βββ routing/ # Feature routing
β β βββ routing/ # routing configuration
β β βββ services/ # Feature-specific services implementations
β β
β βββ auth/ # Auth feature (similar structure)
β βββ dashboard/ # Dashboard feature
β βββ profile/ # Profile feature
β
βββ infrastructure/ # Infrastructure layer
β βββ network/ # Network clients and interceptors
β βββ services/ # Third-party service implementations
β
βββ shared/ # Shared code between features
βββ domain/ # Shared domain logic
βββ presentation/ # Shared UI components
βββββββββββββββββββ
β Presentation β (UI + State Management)
β BLoC/Riverpod β
ββββββββββ¬βββββββββ
β Stream/State
ββββββββββΌβββββββββ
β Domain β (Use Cases + Entities)
β Business Logic β
ββββββββββ¬βββββββββ
β Repository Interface
ββββββββββΌβββββββββ
β Data β (Repository Implementation)
β Local/Remote β
βββββββββββββββββββ
Each feature module manages its own routes:
// Feature-level router
class OnboardingRouter implements BaseRouter {
@override
String get baseRoute => '/onboarding';
@override
List<AutoRoute> get routes => [
AutoRoute(page: OnboardingRoute.page, path: baseRoute),
];
}
// Centralized route registration
class AppRouter extends $AppRouter {
@override
List<AutoRoute> routes => [
...onboardingRouter.routes,
...authRouter.routes,
...dashboardRouter.routes,
];
}| Feature | BLoC | Riverpod | Provider |
|---|---|---|---|
| Authentication | β Primary | ||
| Dashboard | β Primary | ||
| Profile | β Primary |
Using GetIt with Injectable for compile-time dependency injection:
@injectable
class AuthBloc extends Bloc<AuthEvent, AuthState> {
final SignInUseCase _signInUseCase;
final AuthRepository _authRepository;
AuthBloc(this._signInUseCase, this._authRepository);
}- Flutter 3.16+ - Latest stable version
- Dart 3.7+ - Null safety, records, patterns
- Material Design 3 - Modern UI components
- flutter_bloc ^8.1.3 - BLoC pattern implementation
- flutter_riverpod ^2.4.9 - Modern state management
- provider ^6.1.1 - Traditional Flutter state management
- dio ^5.4.0 - HTTP client with interceptors
- retrofit ^4.0.3 - Type-safe API calls
- json_annotation ^4.8.1 - JSON serialization
- freezed ^2.4.6 - Immutable data classes
- hive ^2.2.3 - NoSQL local database
- drift ^2.14.1 - SQLite with type safety
- flutter_secure_storage ^9.0.0 - Secure storage
- lottie ^2.7.0 - Lottie animations
- rive ^0.12.4 - Interactive animations
- shimmer ^3.0.0 - Shimmer loading effects
- fl_chart ^0.66.0 - Beautiful charts
- very_good_analysis ^5.1.0 - Strict linting rules
- injectable ^2.3.2 - Dependency injection
- auto_route ^7.9.2 - Code generation routing
- Flutter SDK (3.16.0 or higher)
- Dart SDK (3.7.0 or higher)
- Android Studio / VS Code
- Git
- Clone the repository
git clone https://github.com/yourusername/devhub-flutter.git
cd devhub-flutter- Install dependencies
flutter pub get- Generate code
flutter packages pub run build_runner build --delete-conflicting-outputs- Run the app
flutter runCreate a .env file in the root directory:
API_BASE_URL=https://api.devhub.com
API_KEY=your_api_key_here
GOOGLE_CLIENT_ID=your_google_client_id
GITHUB_CLIENT_ID=your_github_client_idπΊ Integration Tests (E2E user flows)
πΊπΊ Widget Tests (UI components)
πΊπΊπΊ Unit Tests (Business logic)
# Run all tests
flutter test
# Run tests with coverage
flutter test --coverage
# Run integration tests
flutter test integration_test/- Lazy Loading - Widgets and data loaded on demand
- Image Caching - Efficient network image caching
- Memory Management - Proper disposal of controllers and streams
- Database Optimization - Indexed queries and pagination
- Consistency - Unified design language across all screens
- Accessibility - WCAG 2.1 AA compliant
- Spacing System: 8pt grid system
- Component Library: Reusable UI components
- Responsiveness - Adaptive design for all screen sizes
- Performance - Optimized animations and interactions
// Custom Design System Implementation
class AppTheme {
static ThemeData get lightTheme => // Modern Material 3 theme
static ThemeData get darkTheme => // Dark mode support
}
class AppColors {
static const primary = Color(0xFF6366F1); // Indigo
static const secondary = Color(0xFF10B981); // Emerald
static const accent = Color(0xFFF59E0B); // Amber
}Extensive use of code generation for:
- Freezed - Immutable data classes
- Injectable - Dependency injection
- Auto Route - Type-safe routing
- JSON Serializable - Model serialization
- Advanced Architecture - Multiple proven patterns in production
- State Management Mastery - Comparative implementation of major solutions
- Performance Optimization - Real-world optimization techniques
- Code Quality - Production-ready code standards
- Testing Suite - Comprehensive unit and integration tests
- Offline-First Architecture - Complete offline functionality
- Micro-Frontend Architecture - Modular feature development
- Advanced Analytics - Machine learning insights
- Accessibility Improvements - Enhanced screen reader support
- Performance Monitoring - Real-time performance tracking
- β Authentication System - Complete with social login
- β Core Architecture - Clean Architecture implemented
- β State Management - Multiple patterns demonstrated
- β UI/UX Design - Modern, responsive design system
- β³ Testing Suite - Creating comprehensive testing suite In progress
- β³ Real-time Features - WebSocket integration in progress
- β³ Advanced Analytics - Charts and visualization in progress
