parseRanking function

JsonMap parseRanking(
  1. JsonMap data, {
  2. bool nullIfAbsent = false,
})

Parses a ranking from the charts data.

Implementation

JsonMap parseRanking(JsonMap data, {bool nullIfAbsent = false}) {
  final trendIconType = nav(data, [
    'customIndexColumn',
    'musicCustomIndexColumnRenderer',
    ...ICON_TYPE,
  ], nullIfAbsent: nullIfAbsent);

  return {
    'rank': nav(data, [
      'customIndexColumn',
      'musicCustomIndexColumnRenderer',
      ...TEXT_RUN_TEXT,
    ], nullIfAbsent: nullIfAbsent),
    'trend': trendIconType != null ? TRENDS[trendIconType] : null,
  };
}