initialize static method
Initialize the environment configuration. Throws if the env file cannot be loaded so the caller can handle the failure.
Implementation
static Future<void> initialize({bool isProduction = false}) async {
if (_isInitialized) return;
try {
if (isProduction) {
await dotenv.load(fileName: "prod.env");
} else {
await dotenv.load(fileName: "dev.env");
}
_isInitialized = true;
} catch (e) {
// Do NOT mark as initialized on failure - allow retry
throw Exception(
'Failed to load Lokotro Pay environment configuration. '
'Ensure the ${isProduction ? "prod" : "dev"}.env file is present and accessible. '
'Error: $e',
);
}
}