Overview
Invenicum uses environment variables and compile-time constants to configure API connectivity, timeouts, and core application settings. These settings are defined inlib/config/environment.dart.
Environment Variables
Base URL for the backend API server. This can be overridden at compile time using the
--dart-define flag.Example:Application Constants
These constants are defined inlib/config/environment.dart:7-31 and cannot be changed at runtime.
General Settings
| Constant | Type | Value | Description |
|---|---|---|---|
appName | String | "Invenicum" | Application display name |
appVersion | String | "1.0.0" | Current application version |
apiVersion | String | "/api/v1" | API version path prefix |
baseUrl | String | "$apiUrl/api/v1" | Complete base URL (computed) |
Documentation URLs
| Constant | Type | Value |
|---|---|---|
docsUrl | String | "https://docs.invenicum.com" |
stacDocsUrl | String | "https://docs.stac.dev/introduction" |
Network Timeouts
Connection timeout in milliseconds (15 seconds). Used when establishing initial connection to the API server.
Response timeout in milliseconds (45 seconds). Maximum time to wait for a response after connection is established.
API Endpoints
Authentication endpoints relative tobaseUrl:
| Endpoint | Path | Description |
|---|---|---|
| Login | /auth/login | User authentication |
| Logout | /auth/logout | Session termination |
| Refresh Token | /auth/refresh | Token renewal |
Storage Keys
| Key | Purpose |
|---|---|
authTokenKey | Stores the user’s authentication token |
refreshTokenKey | Stores the refresh token for session renewal |
Configuration Usage
Access environment configuration in your code:Build Configurations
You can create different configurations for development, staging, and production:Best Practices
The
Environment class uses const values for compile-time optimization, meaning values cannot be changed at runtime.Related Files
- Environment Config:
lib/config/environment.dart:1-32 - API Service:
lib/data/services/api_service.dart - Preferences Service:
lib/data/services/preferences_service.dart
