invoke

expect fun <T> KCallable<T>.invoke(instance: Any?, vararg args: Any?): T

Invokes this callable (constructor, method, or property getter/setter) on instance (null for a constructor, a static member, or a companion-object member reached through companionObjectRef) with the given args, returning whatever it returns.

Throws

on Kotlin/JS, where reflective invocation is unsupported.

actual fun <T> KCallable<T>.invoke(instance: Any?, vararg args: Any?): T

Invokes this callable (constructor, method, or property getter/setter) on instance (null for a constructor, a static member, or a companion-object member reached through companionObjectRef) with the given args, returning whatever it returns.

Throws

on Kotlin/JS, where reflective invocation is unsupported.

actual fun <T> KCallable<T>.invoke(instance: Any?, vararg args: Any?): T

Invokes this callable (constructor, method, or property getter/setter) on instance (null for a constructor, a static member, or a companion-object member reached through companionObjectRef) with the given args, returning whatever it returns.

Throws

on Kotlin/JS, where reflective invocation is unsupported.