toMap method
Converts the BugModelCustom object into a map suitable for Firestore storage.
This method prepares the bug data by mapping all its fields to key-value pairs.
It also adds a server-generated timestamp (createdAt
) to track when the bug was created.
Returns:
- A
Map<String, dynamic>
containing the bug details and metadata. purpose: // Converts the bug data into a map for saving in Firestore.
Implementation
Map<String, dynamic> toMap() {
return {
'createdAt': FieldValue.serverTimestamp(),
"userId": userId,
'title': title,
'description': description,
'assignedDeveloper': assignedDeveloper,
'date': date,
'severity': severity,
'status': status,
};
}