token method
Implementation
token(String username, String password) async {
var response = await dio.post(
config.tokenUrl,
data: {
'username': username,
'password': password,
},
);
if (response.statusCode == 200) {
var jwtToken = JwtToken.fromJson(response.data as Map<String, dynamic>);
// _setToken(jwtToken);
return jwtToken;
} else {
// _cleanToken();
// var error = _handleError(response);
throw Exception(response.data);
}
}