Issue
var items: Int by Delegates.notNull<Int>()
db.collection("Testdatabase").get().addOnSuccessListener{ snap->
items=snap.size()
}
Log.i("items",items.toString())
and it says
Property items should be initialized before get
I have to use 'items' variable as a size of the snapshot. I searched some google but I can't figure out.. Can any one help please?
Solution
That happens because your addOnSuccessListener
takes some time to get data. So in this example, you need to put your log statement inside addOnSuccessListener
and you will be fine
Answered By - Dwane13
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.