I am trying to save a list of data to the Firebase Realtime Database in Kotlin. But when I try to save the order gets shuffled as below.
This is my code. Here the locationlist
is the array that contains the list of locations that I want to save in the same order as it is. But when I try to save the after the first element, 10th element is showed. And the pattern continues like that.
ref.child(pk).child("location${count+1}").setValue(locationList).addOnCompleteListener {
Toast.makeText(requireContext() ,"success$pk", Toast.LENGTH_SHORT).show()
}