Code3six / FaangX

0 stars 0 forks source link

Reading individual fields from Firestore #16

Open LavishSwarnkar opened 1 year ago

LavishSwarnkar commented 1 year ago

https://github.com/Code3six/FaangX/blob/0b4924d8cfe8832135b4a60f74daa7917b26683f/app/src/main/java/com/example/faangx/presentation/viewmodel/SharedViewModel.kt#L208-L220 You are reading fields of user class separately like user.data["field"] as Type. This is boilerplate code and must be avoided.

As I said earlier, use the .toObject() function to automatically convert it to object. Read this doc for solution / best practice.

Code3six commented 1 year ago

I will try to change approach, but If I don't understand I will mention this in the meeting.