unpack method
Implementation
void unpack(IsoMsg message, IsoBuffer buffer) {
if (fieldPackagers[0] != null && fieldPackagers[0] is! IsoBitMapPackager) {
final IsoComponent<Object> mti = fieldPackagers[0]!.createComponent();
fieldPackagers[0]!.unpack(mti, buffer);
message.setComponent(0, mti);
}
IsoBitSet? bitmap;
int bitmapBytes = 0;
int highest = fieldPackagers.length - 1;
if (emitsBitmap) {
final IsoComponent<Object> bitmapComponent = fieldPackagers[bitmapFieldIndex]!.createComponent();
fieldPackagers[bitmapFieldIndex]!.unpack(bitmapComponent, buffer);
bitmap = bitmapComponent.value! as IsoBitSet;
bitmapBytes = bitmap.length - 1 + 63 >> 6 << 3;
message.setComponent(bitmapFieldIndex, bitmapComponent);
final int fromBitmap = bitmap.length - 1;
highest = highest < fromBitmap ? highest : fromBitmap;
}
for (int i = firstField; i <= highest; i++) {
if (bitmap == null && fieldPackagers[i] == null) continue;
if (highest > 128 && i == 65) continue;
if (bitmap != null && !bitmap.get(i)) continue;
final IsoFieldPackager? packager = fieldPackagers[i];
if (packager == null) throw IsoFieldException(i, "field packager '$i' is null");
try {
final IsoComponent<Object> component = packager.createComponent();
packager.unpack(component, buffer);
message.setComponent(i, component);
if (i == thirdBitmapField && fieldPackagers.length > 129 && bitmapBytes == 16 && packager is IsoBitMapPackager) {
final IsoBitSet tertiary = message.getComponent(thirdBitmapField)!.value! as IsoBitSet;
highest = 128 + (tertiary.length - 1);
for (int bit = 1; bit <= 64; bit++) {
bitmap!.set(bit + 128, tertiary.get(bit));
}
}
} catch (error) {
if (error is IsoFieldException) rethrow;
throw IsoFieldException(i, "error unpacking field $i", error);
}
}
}