I'm trying to use the match() Expression from Mapbox's Android SDK 9.0.0 with a list of ids. But I'm getting the following error at runtime:
"Error setting property: icon-image [2] Branch labels must be numbers or strings."
I am coding in Kotlin.
To isolate the essence of the problem, I'm trying to pass match() an array of a single String element using the arrayOf()
operator:
match(get(KEY_ID), literal(arrayOf("134")), appearanceIfSelected, appearanceIfNotSelected)
The code above didn't work though and gave the error above. The following code that used arrayListOf()
also failed:
match(get(KEY_ID), literal(arrayListOf(pois!!.first().id)), appearanceIfSelected, appearanceIfNotSelected)
listOf()
also failed:
match(get(KEY_ID), literal(listOf(pois!!.first().id)), appearanceIfSelected, appearanceIfNotSelected)
Wrapping in array()
failed too:
match(get(KEY_ID), array(literal(listOf("134"))), appearanceIfSelected, appearanceIfNotSelected)
I have been wrapping in literal()
because the following won't even compile:
match(get(KEY_ID), arrayOf("134"), appearanceIfSelected, appearanceIfNotSelected)