I cant find any solutions anywhere.. I know this is actually simple but i dont know how.. Here is my code..
var num1 : Int = 0
var num2 : Int = 0
var sum : Int = 0
var db = Firebase.firestore
db.collection("collection1").document("doc1")
.get()
.addOnSuccessListener { document ->
num1 = document.data["num1"].toString().toInt() }
db.collection("collection2").document("doc1")
.get() .addOnSuccessListener { document ->
num2 = document.data["num1"].toString().toInt() }
sum = num1 + num2 tvloading.text = sum.toString()
i know that the variables will work inside the query but i need to use variable outside the query so that i can add two variables from different collections.. please help