fromMap static method
Implementation
static AssignmentEntity? fromMap(Object? o,
{Map<String, String>? newDocumentIds}) {
if (o == null) return null;
var map = o as Map<String, dynamic>;
var taskFromMap = map['task'];
if (taskFromMap != null) {
taskFromMap =
TaskEntity.fromMap(taskFromMap, newDocumentIds: newDocumentIds);
}
var resultsCurrentFromMap = map['resultsCurrent'];
List<AssignmentResultEntity> resultsCurrentList;
if (resultsCurrentFromMap != null) {
resultsCurrentList = (map['resultsCurrent'] as List<dynamic>)
.map((dynamic item) => AssignmentResultEntity.fromMap(item as Map,
newDocumentIds: newDocumentIds)!)
.toList();
} else {
resultsCurrentList = [];
}
var resultsPreviousFromMap = map['resultsPrevious'];
List<AssignmentResultEntity> resultsPreviousList;
if (resultsPreviousFromMap != null) {
resultsPreviousList = (map['resultsPrevious'] as List<dynamic>)
.map((dynamic item) => AssignmentResultEntity.fromMap(item as Map,
newDocumentIds: newDocumentIds)!)
.toList();
} else {
resultsPreviousList = [];
}
var confirmMessageFromMap = map['confirmMessage'];
if (confirmMessageFromMap != null) {
confirmMessageFromMap = WorkflowNotificationEntity.fromMap(
confirmMessageFromMap,
newDocumentIds: newDocumentIds);
}
var rejectMessageFromMap = map['rejectMessage'];
if (rejectMessageFromMap != null) {
rejectMessageFromMap = WorkflowNotificationEntity.fromMap(
rejectMessageFromMap,
newDocumentIds: newDocumentIds);
}
return AssignmentEntity(
appId: map['appId'],
reporterId: map['reporterId'],
assigneeId: map['assigneeId'],
task: taskFromMap,
workflowId: map['workflowId'],
workflowTaskSeqNumber:
int.tryParse(map['workflowTaskSeqNumber'].toString()),
timestamp: map['timestamp'] == null
? null
: (map['timestamp'] as Timestamp).millisecondsSinceEpoch,
status: map['status'],
resultsCurrent: resultsCurrentList,
resultsPrevious: resultsPreviousList,
triggeredById: map['triggeredById'],
confirmMessage: confirmMessageFromMap,
rejectMessage: rejectMessageFromMap,
);
}