fetchChallenges function
Implementation
Future<Map<String, dynamic>> fetchChallenges(String id, String token) async {
Map<String, String> headers = {'Authorization': token};
var request = http.Request(
'GET',
Uri.parse(
'https://pointsystem.api.nudgenow.com/api/v1/multilevel/ml/get/user/$id'),
);
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
return await jsonDecode(await response.stream.bytesToString());
}