format method

String format()

Format the lrc to a readable string that can then be outputted to an LRC file.

Implementation

String format() {
  var output = '';

  output += (artist != null) ? '[ar:$artist]\n' : '';
  output += (album != null) ? '[al:$album]\n' : '';
  output += (title != null) ? '[ti:$title]\n' : '';
  output += (length != null) ? '[length:$length]\n' : '';
  output += (creator != null) ? '[by:$creator]\n' : '';
  output += (author != null) ? '[au:$author]\n' : '';
  output += (offset != null) ? '[offset:${offset.toString()}]\n' : '';
  output += (program != null) ? '[re:$program]\n' : '';
  output += (version != null) ? '[ve:$version]\n' : '';
  output += (language != null) ? '[la:$language]\n' : '';

  for (var lyric in lyrics) {
    output += lyric.formattedLine + '\n';
  }

  return output;
}