Operadores | Exemplo | Ação |
---|---|---|
isNull | “@{isNull(context)}” | Operador que verifica se o paramêtro é nulo. |
isEmpty | “@{isEmpty(")}” | Operador que recebe uma entrada e verifica se ela é vazia. |
length | “@{length(tamanho)}” | Operador que recebe uma entrada e retorna o seu tamanho. |
Um contexto com id numbersArray que possui como 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: "),
Text(
expressionOf("@{length(numbersArray)}")
).setStyle{ backgroundColor = "#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.