How do you define a static extension method in Kotlin? Is this even possible? I currently have an extension method as shown below.
public fun Uber.doMagic(context: Context) {
// ...
}
The above extension can be invoked on an instance.
uberInstance.doMagic(context) // Instance method
but how do I make it static method like shown below.
Uber.doMagic(context) // Static or class method
To create an extension method in kotlin you have to create a kotlin file(not a class) then declare your method in the file Eg:
Import the function in the class or file you are working on and use it.