toStringWithFormat method

String toStringWithFormat(
  1. DetectedType format
)

Returns a string representation of the metadata with the specified format

Implementation

String toStringWithFormat(DetectedType format) {
  final buffer = StringBuffer()
    ..writeln('Vendor: $vendor')
    ..writeln('CommentsCount: $commentsCount');

  // Write comments in lines
  for (final comment in comments.entries) {
    buffer.writeln('\t${comment.key}: ${comment.value}');
  }
  switch (format) {
    case DetectedType.oggOpus:
      buffer
        ..writeln('OpusInfo')
        ..write(opusInfo);
    case DetectedType.oggVorbis:
      buffer
        ..writeln('Vorbis Info')
        ..write(vorbisInfo);
    case DetectedType.oggFlac:
      buffer
        ..writeln('Flac Info')
        ..write(flacInfo);
    case DetectedType.unknown:
    case DetectedType.mp3WithId3:
    case DetectedType.mp3Stream:
      break;
  }

  return buffer.toString();
}