initialize static method

Future<void> initialize()

Implementation

static Future<void> initialize() async {
  await DotEnv.dotenv.load(fileName: ".env");

  String? envString = const String.fromEnvironment('ENVIRONMENT');
  _environment = envString == 'production' ? Environment.production : Environment.staging;

  switch (_environment) {
    case Environment.staging:
      _haivaPython = DotEnv.dotenv.env['HAIVA_STAGING_URL'];
      break;
    case Environment.production:
      _haivaPython = DotEnv.dotenv.env['HAIVA_PRODUCTION_URL'];
      break;
    default:
      throw Exception('Environment not set');
  }
}