A library to make sure code blocks are executed only once
Configuring the dependencies:
dependencies {
implementation("io.johnsonlee:once:1.1.0")
}Then, you can use it in your code:
classGretting {
val once =Once<Unit>()
funhello(name:String): Unit= once {
println("Hello, ${name}")
}
}