editApiKey static method
Edit a single API key in the session
Implementation
static Future<void> editApiKey(
    String name, String newKey, String serviceType) async {
  List<ApiKeyModel> apiKeys = await getApiKeys();
  apiKeys = apiKeys
      .map((apiKey) =>
          apiKey.name == name && apiKey.serviceType == serviceType
              ? ApiKeyModel(
                  name: apiKey.name,
                  key: newKey,
                  serviceType: serviceType,
                  isDefault: apiKey.isDefault)
              : apiKey)
      .toList();
  await saveApiKeys(apiKeys);
}