This message was deleted.
# community-support
s
This message was deleted.
e
map it to another list?
Copy code
val t = s.map { it.filterNotNull() }
println(t.get())
p
Nope, this code will throw an exception:
Cannot query the value of this property because it has no value available.
Which matches the documentation of `add`:
This property will have no value when the given provider has no value.
.
But is there any method which ignores providers without a value?
e
oh that's where the problem is, I see
nope
v
t
I use the following workaround to optionally add a provider to a list provider:
s.addAll(providers.provider {null}.map {listOf(it)}.orElse(emptyList()))
👌 1