setLyric method

void setLyric(
  1. String? lyric
)

Implementation

void setLyric(String? lyric) {
  if (lyric != null) {
    var data =
        [0x03] + [0x00, 0x00, 0x00] + [0x00] + utf8.encode(lyric) + [0x00];
    _frames
        .firstWhere(
          (frame) => listEquals(frame.name, 'USLT'.codeUnits),
          orElse: () {
            _frames.add(ID3Frame('USLT'.codeUnits, List.empty()));
            return _frames.last;
          },
        )
        .data = data;
  } else {
    _frames.remove(
      _frames.firstWhereOrNull(
        (frame) => listEquals(frame.name, 'USLT'.codeUnits),
      ),
    );
  }
}