Skip to main content

Overview

Invenicum uses environment variables and compile-time constants to configure API connectivity, timeouts, and core application settings. These settings are defined in lib/config/environment.dart.

Environment Variables

string
default:"http://192.168.1.43:3000"
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 in lib/config/environment.dart:7-31 and cannot be changed at runtime.

General Settings

Documentation URLs

Network Timeouts

int
default:"15000"
Connection timeout in milliseconds (15 seconds). Used when establishing initial connection to the API server.
int
default:"45000"
Response timeout in milliseconds (45 seconds). Maximum time to wait for a response after connection is established.

API Endpoints

Authentication endpoints relative to baseUrl:

Storage Keys

These keys are used for secure storage. Do not modify unless coordinating with backend changes.

Configuration Usage

Access environment configuration in your code:

Build Configurations

You can create different configurations for development, staging, and production:

Best Practices

For Development: Use your local machine’s IP address instead of localhost when testing on physical devices or emulators.
Security: Never commit production API URLs or credentials to version control. Use environment-specific build configurations instead.
The Environment class uses const values for compile-time optimization, meaning values cannot be changed at runtime.
  • Environment Config: lib/config/environment.dart:1-32
  • API Service: lib/data/services/api_service.dart
  • Preferences Service: lib/data/services/preferences_service.dart