initialize static method
Implementation
static Future<void> initialize() async {
String envFileName = 'packages/binoxuspay/prod.env';
// kDebugMode ? 'packages/binoxuspay/dev.env' : 'packages/binoxuspay/prod.env';
// Load the .env file content as a string
final envContent = await rootBundle.loadString(envFileName);
// Parse the content into the dotenv format
final Map<String, String> envMap = {};
for (var line in envContent.split('\n')) {
final trimmedLine = line.trim();
if (trimmedLine.isNotEmpty && !trimmedLine.startsWith('#')) {
final keyValue = trimmedLine.split('=');
if (keyValue.length == 2) {
envMap[keyValue[0].trim()] = keyValue[1].trim();
}
}
}
// Load the parsed environment variables into dotenv
await dotenv.load(fileName: 'packages/binoxuspay/prod.env');
// Set instance variables
_instance._baseUrl = dotenv.env['BASE_URL'] ?? '';
_instance._localKey = dotenv.env['LOCAL_KEY'] ?? '';
}