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?
itemsbefore you use them inside theLog. Remember that theLogstatement will be executed first due to synchronous execution and then theitems=snap.size()line So you must assign some value to items