Issue
private fun getRadResultList() {
safeLet(
arguments?.getString("referenceVisitId"), arguments?.getString("facilityId")
) { referenceVisitId, facilityId ->
viewModel.getRadResultsWithId(referenceVisitId, facilityId)
}
}
This is my previous code. The number of arguments requested by the function is now one. How do I return the facilityId in getRadResults()
private fun getRadResultList() {
safeLet(
arguments?.getString("facilityId")
) { facilityId ->
viewModel.getRadResults( facilityId)
}
}
This code is the latest version. getRadResult() function wants only the facilityId.
Solution
I'm assuming safeLet
is the function mentioned in Multiple variable let in Kotlin
The thing is, that function is only necessary when wanting to check multiple variables. With a single variable you can use the default let
. So like:
private fun getRadResultList() {
arguments?.getString("facilityId")?.let { facilityId ->
viewModel.getRadResults( facilityId)
}
}
Answered By - Ivo Beckers
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.