LyricLine.fromRaw constructor

LyricLine.fromRaw(
  1. JsonMap rawLyric
)

Converts lyrics in the format from the api to a more reasonable format.

  • rawLyric The raw lyric-data returned by the mobile api.

Returns LyricLine.

Implementation

factory LyricLine.fromRaw(JsonMap rawLyric) {
  final text = rawLyric['lyricLine'] as String;
  final cueRange = rawLyric['cueRange'] as JsonMap;
  final startTime = int.parse(cueRange['startTimeMilliseconds'].toString());
  final endTime = int.parse(cueRange['endTimeMilliseconds'].toString());
  final id = int.parse((cueRange['metadata'] as JsonMap)['id'].toString());
  return LyricLine(text, startTime, endTime, id);
}