toJson method
Returns a JSON-serializable representation of this reference: its type (jsonType) and referencePath, like
the JS SDK's DocumentReference.toJSON(). The Firestore instance and the converter are not part of it; read it
back with DocumentReference.fromJson.
Implementation
Map<String, Object> toJson() {
return <String, Object>{
'type': jsonType,
'referencePath': key.path.canonicalString,
};
}