I'm trying to connect the below API into my flutter code. but I'm getting below error. how to solve this. appreciate your help on this.
I/flutter (15198): null I/flutter (15198): {"success":false,"code":210,"status":"Unauthorized","msg":"You are not authorized to visit this route"}
Map<String, String> loginUserData = {
'email': '',
'password': '',
'id': '',
'userName': '',
'token': '',
'userStatus': '',
'wallet_address': '',
};
@override
void initState() {
_Unlockchallenge();
//dynamic.initState();
asyncMethod();
}
void asyncMethod() async {
await _Unlockchallenge();
}
Future _Unlockchallenge() async {
var response;
print(response);
try {
response = await Dio().get(BASE_API + "challenge/getChallengeByUserAndType/calories",
options: Options(headers: {
'Authorization':loginUserData["token"], //HEADERS
}
));
print(response);
} catch (e) {
print(e);
//throw Exception('Unable to get data');
}
}
