getStatistics function Null safety

Future<MinecraftStatistics> getStatistics(
  1. List<MinecraftStatisticsItem> items

Get's Minecraft: Java Edition, Minecraft Dungeons, Cobalt and Scrolls purchase statistics.

Returns total statistics for ALL games included. To get individual statistics, call this function for each MinecraftStatisticsItem or each game.


Future<MinecraftStatistics> getStatistics(
    List<MinecraftStatisticsItem> items) async {
  if (items.isEmpty) {
    throw ArgumentError.value(
        items, 'items', 'The list of MinecraftStatisticItems cannot be empty.');
  final payload = {
    'metricKeys': [
      for (MinecraftStatisticsItem item in items),
  final headers = <String, String>{'content-type': 'application/json'};
  final response = await requestBody(, _mojangApi, 'orders/statistics', payload,
      headers: headers);
  final data = parseResponseMap(response);
  return MinecraftStatistics.fromJson(data);