My FirebaseFirestore looks like the below image
My code snipped for deserialization is as below:
class StripeProductPlan extends Equatable {
final DocumentReference selfRef;
final Map<String, String> metaData;
final String name;
final String? role;
final String? taxCode;
const StripeProductPlan({
required this.selfRef,
required this.metaData,
required this.name,
this.role,
this.taxCode,
});
factory StripeProductPlan.fromSnapshot(
DocumentSnapshot<Map<String, dynamic>> snapshot) {
final data = snapshot.data()!;
return StripeProductPlan(
metaData: data['metaData'] as Map<String, String>,
selfRef: snapshot.reference,
name: data['name'] as String,
role: data['role'] as String? ?? '',
taxCode: data['taxCode'] as String? ?? '',
);
}
Everything else works, except for the metaData deserialization. How do I fix this?