Lazy init object wrapper.
private val instance: LazySingleton<Foo>()
fun getFoo(context: Context): Foo {
return instance.get {
// this block call once.
// init with Argument.
Foo(context)
}
}
// build.gradle
dependencies {
implementation 'io.github.eaglesakura.lazysingleton:lazysingleton:+'
}