McuImageTLVEntry.decode constructor

McuImageTLVEntry.decode(
  1. List<int> input,
  2. int start,
  3. int end
)

Implementation

factory McuImageTLVEntry.decode(List<int> input, int start, int end) {
  if (start + 4 > end) {
    throw FormatException("tlv header doesn't fit");
  }
  final type = _decodeInt(input, start, 1);
  final length = _decodeInt(input, start + 2, 2);
  if (start + 4 + length > end) {
    throw FormatException("tlv value doesn't fit");
  }
  final value = input.sublist(start + 4, start + 4 + length);
  return McuImageTLVEntry(type, length, value);
}