parseRecordList method
dynamic
parseRecordList(
- dynamic count,
- dynamic recordDescription
Parse a list of records. Record count is optional, if omitted it is read from the stream. Example of recordDescription: { sequenceIndex: Parser.uShort, lookupListIndex: Parser.uShort }
Implementation
parseRecordList(count, recordDescription) {
// If the count argument is absent, read it in the stream.
if (recordDescription == null) {
recordDescription = count;
count = parseUShort();
}
var records = List<Map>.filled(count, {});
var fields = recordDescription.keys.toList();
for (var i = 0; i < count; i++) {
var rec = {};
for (var j = 0; j < fields.length; j++) {
var fieldName = fields[j];
var fieldType = recordDescription[fieldName];
String _fn = fieldType.runtimeType.toString();
if(_fn.startsWith("()")) {
rec[fieldName] = fieldType.call();
} else {
rec[fieldName] = fieldType.call(this);
}
}
records[i] = rec;
}
return records;
}