getProfile method
Implementation
Future<Profile> getProfile() async {
var url = Constant.baseURL + Constant.getProfile;
final response = await http.get(Uri.parse(url), headers: {
"Content-Type": "application/json",
"accept": "application/json",
"x-api-key": SwirepaySdk.secretKey
});
final result = jsonDecode(response.body);
var profile = Profile();
if (response.statusCode == 200 && result["entity"]?.toString() != "") {
profile = Profile.fromJson(result["entity"]);
} else {
profile.error = result["message"].toString();
}
return profile;
}