Test.fromMap constructor
Constructs a Test instance from a map.
snapshot
is a map containing the test data.
id
is the unique identifier of the test.
Implementation
Test.fromMap(Map snapshot, String id)
: id = snapshot['id'],
documentId = snapshot['documentId'] ?? '',
motherId = snapshot['motherId'],
deviceId = snapshot['deviceId'],
doctorId = snapshot['doctorId'],
weight = snapshot['weight'],
gAge = snapshot['gAge'],
age = snapshot['age'],
fisherScore = snapshot['fisherScore'],
fisherScore2 = snapshot['fisherScore2'],
motherName = snapshot['motherName'],
deviceName = snapshot['deviceName'],
doctorName = snapshot['doctorName'],
patientId = snapshot['patientId'],
organizationId = snapshot['organizationId'],
organizationName = snapshot['organizationName'],
imageLocalPath = snapshot['imageLocalPath'],
imageFirePath = snapshot['imageFirePath'],
audioLocalPath = snapshot['audioLocalPath'],
audioFirePath = snapshot['audioFirePath'],
isImgSynced = snapshot['isImgSynced'],
isAudioSynced = snapshot['isAudioSynced'],
bpmEntries = snapshot['bpmEntries'] != null
? snapshot['bpmEntries'].cast<int>()
: <int>[],
bpmEntries2 = snapshot['bpmEntries2'] != null
? snapshot['bpmEntries2'].cast<int>()
: <int>[],
mhrEntries = snapshot['mhrEntries'] != null
? snapshot['mhrEntries'].cast<int>()
: <int>[],
spo2Entries = snapshot['spo2Entries'] != null
? snapshot['spo2Entries'].cast<int>()
: <int>[],
baseLineEntries = snapshot['baseLineEntries'] != null
? snapshot['baseLineEntries'].cast<int>()
: <int>[],
movementEntries = snapshot['movementEntries'] != null
? snapshot['movementEntries'].cast<int>()
: <int>[],
autoFetalMovement = snapshot['autoFetalMovement'] != null
? snapshot['autoFetalMovement'].cast<int>()
: <int>[],
tocoEntries = snapshot['tocoEntries'] != null
? snapshot['tocoEntries'].cast<int>()
: <int>[],
lengthOfTest = snapshot['lengthOfTest'],
averageFHR = snapshot['averageFHR'],
live = snapshot['live'] ?? false,
testByMother = snapshot['testByMother'],
testById = snapshot['testById'],
interpretationType = snapshot['interpretationType'],
interpretationExtraComments = snapshot['interpretationExtraComments'],
associations = snapshot['association'] is String
? jsonDecode(snapshot['association'])
: snapshot['association'],
// autoInterpretations = snapshot['autoInterpretations'] is String?
// ? jsonEncode(snapshot['autoInterpretations'] ?? '')
// : snapshot['autoInterpretations'],
delete = snapshot['delete'],
createdOn = DateTime.parse(snapshot['createdOn']),
createdBy = snapshot['createdBy'];