0

I can see that GenericTypeIndicator is from Firebase but I'm getting Unresolved reference: GenericTypeIndicator

Alternatively, I have a custom class

class Foo<T : Car> {
    ...
}

When I make a request to Firestore and want to convert DocumentSnapshot to my POJO, how exactly should I do? I'm getting Could not deserialize object. Class Foo has generic type parameters, please use GenericTypeIndicator instead. Does that mean I have to do something like here?

user1865027
  • 3,505
  • 6
  • 33
  • 71
  • Yes, GenericTypeIndicator is apart of Firebase Realtime Database Android SDK, so it cannot be used to get data from Firestore. If you need to get a "List" of custom objects, I think this article might help, [How to map an array of objects from Cloud Firestore to a List of objects?](https://medium.com/firebase-tips-tricks/how-to-map-an-array-of-objects-from-cloud-firestore-to-a-list-of-objects-122e579eae10). – Alex Mamo Mar 23 '21 at 08:45
  • @AlexMamo but I have generic type. does that mean I'll need to create a new class for each type? – user1865027 Mar 26 '21 at 00:26

0 Answers0