A Flutter application for managing and viewing user data with offline support, search functionality, and modern UI/UX design.
This app demonstrates modern Flutter development practices including:
- Clean Architecture with BLoC pattern
- Dependency Injection with GetIt
- Network API integration with Dio
- Offline data persistence with HydratedBloc
- State management with flutter_bloc
- Navigation with GoRouter
- Responsive UI with Cupertino design
- User List View: Browse users with pagination support
- User Search: Real-time search functionality with debouncing
- User Details: Detailed view for individual users
- Offline Support: App works without internet connection using cached data
- Pull-to-Refresh: Refresh user data with swipe gesture
- Error Handling: Comprehensive error states and retry mechanisms
- Loading States: Smooth loading indicators and skeleton screens
- Infinite Scroll: Automatic loading of more users as you scroll
lib/
├── blocs/ # BLoC state management
│ ├── user_list_bloc.dart
│ ├── user_list_event.dart
│ ├── user_list_state.dart
│ └── internet_connection_cubit.dart
├── data/ # Data layer
│ └── apis/
│ ├── base/ # Base API classes and error handling
│ └── user/ # User-specific API calls
├── di/ # Dependency injection setup
├── models/ # Data models with JSON serialization
│ └── users_response.dart
├── screens/ # UI screens
│ ├── user_list_screen.dart
│ └── user_detail_screen.dart
├── widgets/ # Reusable UI components
├── utils/ # Utility functions and helpers
├── router.dart # Navigation setup
└── main.dart # App entry point
The app uses the BLoC pattern for state management:
UserListBloc: Manages user list state, pagination, search, and API callsInternetConnectionCubit: Monitors internet connectivityHydratedBloc: Provides automatic state persistence for offline support
- API Layer:
UserApihandles HTTP requests using Dio - BLoC Layer: Business logic and state management
- UI Layer: Reactive widgets that rebuild based on state changes
- Persistence: HydratedBloc automatically saves/restores state
flutter_bloc: ^9.1.1- State managementdio: ^5.8.0+1- HTTP clientgo_router: ^15.1.2- Navigationhydrated_bloc: ^10.0.0- State persistenceget_it: ^8.0.3- Dependency injectioninjectable: ^2.5.0- DI code generation
freezed: 3.0.6- Immutable data classesjson_serializable: 6.9.5- JSON serializationbuild_runner: 2.4.15- Code generationinjectable_generator: 2.7.0- DI code generation
connectivity_plus: ^6.0.5- Network connectivity monitoringinternet_connection_checker: ^3.0.1- Internet connection validationdiacritic: ^0.1.5- Text search normalizationdart3z: ^0.11.1- Functional programming utilities
- Flutter SDK 3.7.2 or later
- Dart SDK 3.7.2 or later
- Android Studio / VS Code with Flutter extensions
-
Clone the repository
git clone <repository-url> cd user_management_app
-
Install dependencies
flutter pub get
-
Generate code (for models and DI)
flutter packages pub run build_runner build --delete-conflicting-outputs
-
Run the app
flutter run
For development with hot reload and debugging:
# Run in debug mode
flutter run --debug
# Run with specific device
flutter run -d <device-id>
# Run on web
flutter run -d chromeThe app integrates with JSONPlaceholder API for user data:
- Base URL:
https://reqres.in/api - Endpoints:
GET /users- Fetch paginated user list- Query parameters:
page,per_page,delay
{
"page": 1,
"per_page": 6,
"total": 12,
"total_pages": 2,
"data": [
{
"id": 1,
"email": "george.bluth@reqres.in",
"first_name": "George",
"last_name": "Bluth",
"avatar": "https://reqres.in/img/faces/1-image.jpg"
}
],
"support": {
"url": "https://reqres.in/#support-heading",
"text": "To keep ReqRes free, contributions towards server costs are appreciated!"
}
}The project uses code generation for:
- Freezed: Immutable data classes and unions
- JSON Serializable: JSON serialization/deserialization
- Injectable: Dependency injection setup
Run code generation:
flutter packages pub run build_runner buildWatch for changes during development:
flutter packages pub run build_runner watch# Run all tests
flutter test
# Run tests with coverage
flutter test --coverage
# Run integration tests
flutter test integration_test/test/- Unit and widget testsintegration_test/- Integration teststest_driver/- Driver tests for automated testing
-
Build APK:
flutter build apk --release
-
Build App Bundle (recommended for Play Store):
flutter build appbundle --release
-
Build for iOS:
flutter build ios --release
-
Archive in Xcode for App Store distribution
- Build for web:
flutter build web --release
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Dart Style Guide
- Use
flutter analyzeto check for issues - Format code with
dart format
- Write unit tests for business logic
- Use BLoC pattern for state management
- Follow the established project structure
- Add proper error handling
- Document complex functionality
-
Build errors after pulling changes
flutter clean flutter pub get flutter packages pub run build_runner build --delete-conflicting-outputs
-
Dependency conflicts
flutter pub deps flutter pub upgrade
-
Code generation issues
flutter packages pub run build_runner clean flutter packages pub run build_runner build --delete-conflicting-outputs
- Use
flutter run --profilefor performance profiling - Monitor network calls in debug mode
- Check memory usage with Flutter Inspector
This project is licensed under the MIT License - see the LICENSE file for details.
- ReqRes API for providing the test API
- Flutter team for the amazing framework
- BLoC library contributors for excellent state management
- All open-source contributors whose packages made this project possible