There are ways that you can declare functions on nullable types. Mostly, this is used by Kotlin itself to provide some convenience functions in its standard library.

For example, CharSequence? (the superclass of String?) has an isNullOrEmpty() function that returns true if it is called on the empty string ("") or null.

You can learn more about this in:
Run Edit