Kotlin Not able to recognise Deferred/Promise/Future values in a map which has Values as String or Deferred Value
val varToValue = mapOf("@id" to arg.userId, "@salary" to arg.salary)
for (variable in varToValue.keys) {
fieldData = fieldData.replace(Regex(variable),if(varToValue[variable] is String) varToValue[variable] else varToValue[variable]?.await() ?: "") //here
}
Here fieldData is a string which might contain @id or @salary. arg.id is of type String and arg.salary is of type Deferred. Now the line where I call the replace function is not able to identify...