Atlas API Client (Dart)
Relevant source files
The following files were used as context for generating this wiki page:
The Atlas API Client is a shared Dart package within the AtlasCleanAI Enterprise monorepo. It handles HTTP communication between Flutter applications and the backend API tier. The client provides a standardized layer for JSON parsing, error handling, and authenticated requests.
Sources: README.md:144-150, packages/atlas_api_client/pubspec.yaml
Purpose and Scope
The package enables consistent integration across the three primary mobile platforms: the Customer App, the Cleaner App, and the Management App. It centralizes the logic for interacting with core systems such as the Booking Engine, Workforce Management, and Payments. By using this shared package, developers ensure that all client applications follow the same protocol for bearer token authentication and response processing.
Sources: README.md:144-150, README.md:179-184
Technical Architecture
The Atlas API Client operates as a dependency for the enterprise Flutter applications. It relies on the http package for low-level network requests. The client abstracts these requests into a reusable service layer.
Core Dependencies
The package maintains a minimal dependency footprint to ensure compatibility across different Flutter environments.
| Dependency | Version | Purpose |
|---|---|---|
http | ^1.2.2 | Core HTTP request functionality |
lints | ^5.0.0 | Development-time code quality enforcement |
test | ^1.25.8 | Unit and integration testing framework |
Sources: packages/atlas_api_client/pubspec.yaml:10-15
Data Flow Integration
The following diagram illustrates how the API client connects the mobile applications to the backend infrastructure.
The diagram shows the sequence where a Flutter application initiates a request, which is then processed by the shared client, authenticated, sent to the AWS infrastructure, and finally parsed back into a usable format for the UI.
Sources: README.md:43-52, README.md:148-150
Implementation Details
Configuration and Environment
The package is compatible with Dart SDK versions 3.1.0 and above. It is configured as a private package (publish_to: none) to prevent accidental public publishing of internal enterprise logic.
Sources: packages/atlas_api_client/pubspec.yaml:5-8
Functionality Modules
The client implements several critical communication features:
- Authenticated Requests: Automatically attaches bearer tokens to outgoing headers for protected routes.
- Success/Error Handling: Standardizes how the application interprets HTTP status codes (e.g., 200 OK vs 401 Unauthorized).
- JSON Serialization: Maps backend data models to Dart objects for type-safe development.
Sources: README.md:148-151
Consumer Integration
The client applications (Customer, Cleaner, and Management) utilize specialized networking libraries like dio and retrofit alongside the atlas_api_client to manage complex API interactions and state management via flutter_bloc.
| Application | Primary Purpose | Key Networking Dependencies |
|---|---|---|
| Customer App | Booking and service lifecycle | dio, retrofit, flutter_stripe |
| Cleaner App | Schedule and job management | dio, retrofit, google_maps_flutter |
| Management App | Workforce and billing oversight | dio, retrofit, fl_chart |
Sources: apps/customer_app/pubspec.yaml:14-16, apps/cleaner_app/pubspec.yaml:14-16, apps/management_app/pubspec.yaml:14-16
Request Sequence
This sequence diagram depicts a typical authenticated request flow for booking a service.
The sequence shows the internal coordination between the UI, the shared client, local secure storage for credentials, and the remote API.
Sources: README.md:148-151, apps/customer_app/pubspec.yaml:20-21
Summary
The Atlas API Client (Dart) provides the essential communication bridge for the AtlasCleanAI Enterprise ecosystem. By centralizing HTTP logic in packages/atlas_api_client, the platform achieves consistency in authentication, error handling, and data parsing across all mobile applications. This shared foundation reduces duplication and ensures that updates to the API protocol are reflected uniformly across the customer, cleaner, and management interfaces.
Sources: README.md:16-19, README.md:144-151