getUserSolveCountByDifficulty method

Future<UserSolveCountByDifficultyDetails> getUserSolveCountByDifficulty({
  1. required String username,
})

Implementation

Future<UserSolveCountByDifficultyDetails> getUserSolveCountByDifficulty({required String username}) async {
  final data = await makeGraphQLRequest(getGraphQLPayloadUserSolveCountByDifficulty(username: username));
  final allQuestionsCountJsonList = data['data']['allQuestionsCount'] as List;
  final allQuestionsCountList =
      allQuestionsCountJsonList.cast<Map<String, dynamic>>().map(DifficultyCount.fromJson).toList();
  final solveCount = UserSolveCountByDifficulty.fromJson(data['data']['matchedUser']);
  return UserSolveCountByDifficultyDetails(
    allQuestionsCount: allQuestionsCountList,
    solveCount: solveCount,
  );
}