createInstance

fun <T : Any> KClass<T>.createInstance(): T

Creates a new instance of the class, calling a constructor which either has no parameters or all parameters of which are optional (see KParameter.isOptional). If there are no or many such constructors, an exception is thrown.

Since Kotlin

1.1