1

I'm tying to get from my firebase realtime database list of data. Here is my code:

firebaseDatabase.child(NEWS_LIST).get().addOnSuccessListener {
    result = Result.success(it.getValue(List<NewsModel>::class.java))
}.addOnFailureListener {
    result = generateErrorResult(it)
}

But when I try to retrieve value from my DataSnapshot I get error:

Only classes are allowed on the left hand side of a class literal

I also tried:

it.getValue(object : TypeToken<List<NewsModel>>() {}.type)

None of the following functions can be called with the arguments supplied.

Is it possible to somehow fix this error? Please help me

testivanivan
  • 967
  • 13
  • 36
  • https://stackoverflow.com/questions/46401104/only-classes-are-allowed-on-the-left-hand-side-of-a-class-literal did you check that – Edgar Jun 14 '21 at 18:18
  • The data beneath NEWS_LIST child node, is a List of type NewsModel? Please edit your question and add your database structure as a JSON file. You can simply get it by clicking the Export JSON in the overflow menu (⠇) in your [Firebase Console](https://console.firebase.google.com/u/0/project/_/database/data). – Alex Mamo Jun 15 '21 at 06:25

0 Answers0