updateConfig static method
Update configuration securely
Implementation
static Future<void> updateConfig({
String? backendUrl,
String? apiKey,
Map<String, dynamic>? merchantInfo,
}) async {
try {
final currentBackendUrl = backendUrl ?? await getBackendUrl();
final currentApiKey = apiKey ?? await getApiKey();
final currentMerchantInfo = merchantInfo ?? await getMerchantInfo();
if (currentBackendUrl == null || currentApiKey == null || currentMerchantInfo == null) {
throw Exception('Cannot update incomplete configuration');
}
await initializeConfig(
backendUrl: currentBackendUrl,
apiKey: currentApiKey,
merchantInfo: currentMerchantInfo,
);
} catch (e) {
throw Exception('Failed to update configuration: $e');
}
}