'Flutter JSON serializable using json_annotation package how to use JsonConverter with Firebase Firestore DocumentReference
I'm trying to save a DocumentReference in models using JSON serializable with a custom JsonConverter but not doing it correct
here is my model
@DocumentSerializer()
DocumentReference? recentTrainingRef;
My DocumentSerializer Class
class DocumentSerializer
implements JsonConverter<DocumentReference, DocumentReference> {
const DocumentSerializer();
@override
DocumentReference fromJson(DocumentReference docRef) => docRef;
@override
DocumentReference toJson(DocumentReference docRef) => docRef;
}
I'm getting the following error Could not generate fromJson code for recentTrainingRef.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
