calculateTotalSize method
Calculate the total size for the defined cell sizes list.
Throws an ArgumentError if any item in the collection is not Weight or Fixed.
Implementation
TotalSize calculateTotalSize() {
double totalWeightSize = 0;
double totalFixedSize = 0;
for (var cellSize in this) {
switch (cellSize) {
case Weight():
totalWeightSize += cellSize.size;
break;
case Fixed():
totalFixedSize += cellSize.size;
break;
}
}
return TotalSize(weight: totalWeightSize, fixed: totalFixedSize);
}