I’m using Anko for Android UI developlment, DSL design is awesome, but I can’t access inline block variable, I have to write code like this:
var t: TextView? = null // it's nullable
var i: ImageView by Delegates.notNull() // it's heavy and stupid.
linearLayoutCompat {
t = textView {
TODO()
}
i = imageView {
TODO()
}
val foobar = imageView {
TODO()
}
//access inside variable foobar here is ok.
}
// using inside variable outside inline block.
t!!.let {
TODO()
}
//breaks non-null logical.
t?.let {
TODO()
}
what if there is a feature that marks variable inside inline block can be accessed outside ?