postLogData method
Sends log data to the server using an HTTP POST request.
body
- The log data to be sent in the request body.
Returns a Future
Implementation
Future<Response?> postLogData(Map<String, dynamic> body) async {
try {
return await dio!.post(apiPrefix, data: body);
} catch (e) {
if (e is DioException) {
if (e.response?.statusCode == 401) {
developer.log(
'Your API token is invalid. Please check your token and try again.');
} else {
developer
.log('An error occurred while sending log data to the server.');
}
}
}
return null;
}