sendMessage static method
Future
sendMessage(
- dynamic data
)
Implementation
static Future sendMessage(data) async {
try {
final jsonData = await StoreBountyInit.readJsonFromRoot();
final response = await HttpClientClass
.postRequestAuthOrder("${jsonData['BASE_URL']}/accounts/api/v1/messaging/customers/messages/send", data);
// print(response.body);
if (response.statusCode == 200) {
return response;
} else if (response.statusCode == 412) {
var error = jsonDecode(response.body);
throw StoreBountyException(error['message']);
} else {
var error = jsonDecode(response.body);
throw StoreBountyException("${error['message']}");
}
} catch (e) {
throw StoreBountyException("$e");
}
}