save method

void save()

Implementation

void save() {
  if (_cover != null) {
    if (_cover!.isNotEmpty) {
      // In fact, only image's byte data matters, the other information is usually ignored, even the MIME type.
      List<int> data =
          [0x00, 0x00, 0x00, 0x03] + // image type (use as)
          [0x00, 0x00, 0x00, 0x0a] + // MIME length
          'image/jpeg'.codeUnits + // MIME type
          [0x00, 0x00, 0x00, 0x00] + // description length
          [] + // description
          [0x00, 0x00, 0x00, 0x00] + // image width
          [0x00, 0x00, 0x00, 0x00] + // image height
          [0x00, 0x00, 0x00, 0x00] + // color digit
          [0x00, 0x00, 0x00, 0x00]; // index image's color's count
      // image size
      int imageSize = _cover!.length;
      data.add(imageSize >> 24);
      imageSize %= 0x1000000;
      data.add(imageSize >> 16);
      imageSize %= 0x10000;
      data.add(imageSize >> 8);
      imageSize %= 0x100;
      data.add(imageSize);

      data += _cover!;
      _flacMetaBlock.data = data;
      return;
    }
  }
  _flacMetaBlock.data = [];
}