A Flutter mobile application that displays insurance claims using mock data from the JSONPlaceholder API.
- Claims List Screen: Displays a scrollable list of insurance claims with search and filtering functionality
- Claim Detail Screen: Shows comprehensive details of a selected claim
- Search Functionality: Search claims by title, description, claim ID, or claimant ID
- Loading States: Displays loading indicators during data fetching
- Error Handling: Robust error handling with retry functionality
- Pull to Refresh: Refresh claims data with pull-to-refresh gesture
This application follows clean architecture principles with BLoC (Business Logic Component) pattern:
- Models: Data models for claims (
Claim) - Services: API service layer (
ClaimService) for data fetching - BLoC: State management using BLoC pattern (
ClaimsBloc,ClaimsEvent,ClaimsState) - Screens: UI components (
ClaimsListScreen,ClaimDetailScreen) - Error Handling: Custom exception handling (
ClaimServiceException)
The app uses the JSONPlaceholder API as a mock backend:
- Endpoint:
https://jsonplaceholder.typicode.com/posts - Mapping: Posts are mapped to insurance claims where:
userId→ Claimant IDid→ Claim IDtitle→ Claim Titlebody→ Claim Description
- Flutter SDK (>=3.4.0)
- Dart SDK
- Android Studio / VS Code with Flutter extensions
- An emulator or physical device for testing
-
Clone the repository
git clone <repository-url> cd insurance_claims
-
Install dependencies
flutter pub get
-
Run the application
flutter run
Execute unit tests and widget tests:
flutter testAndroid APK:
flutter build apk --releaseiOS (requires macOS):
flutter build ios --releaselib/
├── main.dart # App entry point
├── bloc/
│ ├── claims_bloc.dart # Claims BLoC implementation
│ ├── claims_event.dart # Claims events
│ └── claims_state.dart # Claims states
├── models/
│ └── claim.dart # Claim data model
├── screens/
│ ├── claims_list_screen.dart # Claims list UI
│ └── claim_detail_screen.dart # Claim detail UI
└── services/
└── claim_service.dart # API service layer
test/
├── bloc/
│ └── claims_bloc_test.dart # BLoC unit tests
├── models/
│ └── claim_test.dart # Model unit tests
├── screens/
│ ├── claims_list_screen_test.dart # List screen widget tests
│ └── claim_detail_screen_test.dart # Detail screen widget tests
├── services/
│ └── claim_service_test.dart # Service unit tests
└── widget_test.dart # Main app integration test
- http: ^1.1.0 - HTTP client for API requests
- flutter_bloc: ^8.1.3 - BLoC state management
- equatable: ^2.0.5 - Value equality for BLoC states
- flutter: SDK
- cupertino_icons: ^1.0.6 - iOS style icons
- flutter_test: SDK - Testing framework
- bloc_test: ^9.1.4 - BLoC testing utilities
- flutter_lints: ^3.0.0 - Dart linting rules
The application includes comprehensive testing:
- Unit Tests: Models and services
- Widget Tests: UI components and user interactions
- Integration Tests: App flow and navigation
Test coverage includes:
- Claim model serialization/deserialization
- API service error handling
- UI component rendering
- User interaction flows
- Network error scenarios
- Architecture: Used BLoC pattern with clean architecture for separation of concerns
- State Management: BLoC pattern for predictable state management
- Error Handling: Implemented custom exceptions for better error management
- UI/UX: Material Design 3 for consistent user experience
- Testing: Comprehensive test suite with BLoC testing and mocking for reliable testing
- Dependencies: Minimal external dependencies focused on essential functionality
- Add offline capability with local database
- Implement claim creation and editing
- Add user authentication
- Include push notifications for claim updates
- Add data visualization and analytics
- Implement caching strategies for better performance
- Add pagination for large datasets





