The Standard.kt function

Kotlin has already defined some extension functions and Standard.kt is part of those functions. It has functions like with(), apply(), let(). The file has more than these extension functions, but we are only highlighting the ones commonly used in Android:

    **     * Calls the specified function [block] with the given [receiver]         as its receiver and returns its result.     */    @kotlin.internal.InlineOnly    public inline fun <T, R> with(receiver: T, block: T.() -> R): R =      receiver.block()    /**      * Calls the specified function [block] with `this` value as its        receiver and returns `this` value.      */    @kotlin.internal.InlineOnly    public inline fun <T> T.apply(block: T.() -> Unit): T { block();        return this }    /** * Calls the specified function ...

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.