@michbarsinai Your current issue is mainly because when e.name is a java.lang.String then typeof e.name returns "object" (as all java objects do) while typeof "ABC" returns "string" so it will be ...
java.lang.ClassCastException: class kotlin.Result cannot be cast to class java.lang.String (kotlin.Result is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader ...