decode static method

Id3v22FrameHeader? decode(
  1. Id3v2Header id3v2Header,
  2. List<int> bytes,
  3. int startIndex
)
override

Decodes the FrameHeader

Returns null if the FrameHeader could not be decoded

Implementation

static Id3v22FrameHeader? decode(
  Id3v2Header id3v2Header,
  List<int> bytes,
  int startIndex,
) {
  String identifierId = latin1.decode(bytes.sublist(startIndex, startIndex + 3));
  FrameIdentifier? frameIdentifier = frameIdentifiers.firstWhereOrNull((element) => element.v22Name == identifierId);

  if (frameIdentifier == null) {
    return null;
  }

  var contentSize = _decodeFrameSize(bytes, startIndex + identifierFieldSize);

  return Id3v22FrameHeader(frameIdentifier, contentSize);
}