Veja abaixo quais são os outros operadores:
Operadores | Exemplo | Ação |
---|---|---|
isNull | isNull(expressionOf("@{context}") | Operador que verifica se o paramêtro é nulo. |
isEmpty | isEmpty(expressionOf("@{context}") | Operador que recebe uma entrada e verifica se ela é vazia. |
length | length(expressionOf("@{context}") | Operador que recebe uma entrada e retorna o seu tamanho. |
Neste exemplo, um contexto com id numbersArray possui o valor [0, 1, 2, 3, 4] e a operação **length**
foi utilizada em um componente Text
para pegar o tamanho desse array, veja abaixo:
fun screen() = Screen(
child = Container(
context = ContextData(id = "numbersArray", value = arrayOf(0, 1, 2, 3, 4)),
children = listOf(
Text(text = "Array [0, 1, 2, 3, 4] has size: "),
Container(
children = listOf(
Text(length(expressionOf("@{numbersArray}")).toBindString())
)
).setStyle { backgroundColor = constant("#00FF00") }
)
)
)
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.