EnvironmentConfig class abstract

Generic environment configuration

Developers can extend this for their specific needs.

Example:

class MyConfig extends EnvironmentConfig {
  @override
  final Environment environment;

  const MyConfig(this.environment);

  @override
  String get baseUrl {
    return switch (environment) {
      Environment.development => 'https://dev-api.example.com',
      Environment.staging => 'https://staging-api.example.com',
      Environment.production => 'https://api.example.com',
    };
  }

  @override
  Map<String, dynamic> get headers => {
    'X-App-Version': '1.0.0',
    'X-Environment': environment.name,
  };
}

// Usage
const config = MyConfig(Environment.production);

KeystoneNetwork.initialize(
  baseUrl: config.baseUrl,
  connectTimeout: config.connectTimeout,
  headers: config.headers,
);
Implementers

Constructors

EnvironmentConfig()

Properties

baseUrl → String
Base URL for API requests
no setter
connectTimeout → Duration
Connection timeout duration
no setter
enableLogging → bool
Enable debug logging
no setter
environment → Environment
Current environment
no setter
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, dynamic>
Default headers for all requests
no setter
receiveTimeout → Duration
Response receive timeout duration
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sendTimeout → Duration
Request send timeout duration
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited