postSpaMessage method
Send spa massage to server.
Implementation
@override
Future<Map<String, dynamic>> postSpaMessage(EventSpa event, String uriServiceSpa) async {
try {
Response<dynamic> response = await _dio.post(
uriServiceSpa,
data: event.toJson,
options: Options(
headers: {
'Content-Type': 'application/json',
},
),
);
if (response.statusCode == 200) {
return response.data;
} else {
throw Exception('Error while sending the message.');
}
} catch (_) {
throw Exception('Error while sending the message.');
}
}