sendHit method

Future<void> sendHit(
  1. Hit pHit
)

Send Hit

Implementation

Future<void> sendHit(Hit pHit) async {
  /// Create url
  String urlString = Endpoints.ARIANE;
  try {
    var response = await _service.sendHttpRequest(
        RequestType.Post, urlString, fsHeader, jsonEncode(pHit.bodyTrack),
        timeoutMs: TIMEOUT_REQUEST);
    switch (response.statusCode) {
      case 200:
      case 204:
      case 201:
        Flagship.logger(Level.INFO, HIT_SUCCESS);
        break;
      default:
        Flagship.logger(Level.ERROR, HIT_FAILED);
    }
  } catch (error) {
    Flagship.logger(
        Level.EXCEPTIONS, EXCEPTION.replaceFirst("%s", "$error") + urlString);
    Flagship.logger(Level.ERROR, HIT_FAILED);
  }
}