I'd like to convert a dynamic map object on Firestore into Flutter. Below is an example:
The map for blocked users can change. Sometimes, it may contain 3 blocked users
Other times, it may contain 2.

Below is my current code:
class UserModel {
String userId;
String bio;
///add in dynamic blockedusers mapping
}
UserModel(
{
this.userId,
this.bio,
///add in dynamic blockedusers mapping
}
UserModel.fromJson(Map<dynamic, dynamic> map) {
userId = map['userId'];
bio = map['bio'];
///add in dynamic blockedusers mapping
}
toJson() {
return {
"userId": userId,
'bio': bio,
///add in dynamic blockedusers mapping
};
}
Given that the map object changes, is there a way to dynamically map it from Firestore into Flutter or map it from Flutter into Firestore? Thanks in advance!